@@ -34,7 +34,7 @@ var expectedObj = headers.BlockHeaderResponse{
3434func TestGetHeaderByHash (t * testing.T ) {
3535 t .Run ("failure when authorization on and empty auth header" , func (t * testing.T ) {
3636 // given
37- bhs , cleanup := testapp .NewTestBlockHeaderService (t )
37+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp . WithRandomPort () )
3838 defer cleanup ()
3939 expectedResult := struct {
4040 code int
@@ -54,7 +54,7 @@ func TestGetHeaderByHash(t *testing.T) {
5454
5555 t .Run ("success" , func (t * testing.T ) {
5656 // given
57- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
57+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
5858 defer cleanup ()
5959 expectedResult := struct {
6060 code int
@@ -78,7 +78,7 @@ func TestGetHeaderByHash(t *testing.T) {
7878
7979 t .Run ("failure - hash not found" , func (t * testing.T ) {
8080 // given
81- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
81+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
8282 defer cleanup ()
8383 expectedResult := struct {
8484 code int
@@ -100,7 +100,7 @@ func TestGetHeaderByHash(t *testing.T) {
100100func TestGetHeaderByHeight (t * testing.T ) {
101101 t .Run ("failure when authorization on and empty auth header" , func (t * testing.T ) {
102102 // given
103- bhs , cleanup := testapp .NewTestBlockHeaderService (t )
103+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp . WithRandomPort () )
104104 defer cleanup ()
105105 expectedResult := struct {
106106 code int
@@ -120,7 +120,7 @@ func TestGetHeaderByHeight(t *testing.T) {
120120
121121 t .Run ("success" , func (t * testing.T ) {
122122 // given
123- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
123+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
124124 defer cleanup ()
125125 expectedResult := struct {
126126 code int
@@ -144,7 +144,7 @@ func TestGetHeaderByHeight(t *testing.T) {
144144
145145 t .Run ("failure - hash not found" , func (t * testing.T ) {
146146 // given
147- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
147+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
148148 defer cleanup ()
149149 expectedResult := struct {
150150 code int
@@ -166,7 +166,7 @@ func TestGetHeaderByHeight(t *testing.T) {
166166func TestGetHeaderAncestorsByHash (t * testing.T ) {
167167 t .Run ("failure when authorization on and empty auth header" , func (t * testing.T ) {
168168 // given
169- bhs , cleanup := testapp .NewTestBlockHeaderService (t )
169+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp . WithRandomPort () )
170170 defer cleanup ()
171171 expectedResult := struct {
172172 code int
@@ -186,7 +186,7 @@ func TestGetHeaderAncestorsByHash(t *testing.T) {
186186
187187 t .Run ("success" , func (t * testing.T ) {
188188 // given
189- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
189+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
190190 defer cleanup ()
191191 expectedResult := struct {
192192 code int
@@ -210,7 +210,7 @@ func TestGetHeaderAncestorsByHash(t *testing.T) {
210210
211211 t .Run ("failure - hash not found" , func (t * testing.T ) {
212212 // given
213- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
213+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
214214 defer cleanup ()
215215 expectedResult := struct {
216216 code int
@@ -232,7 +232,7 @@ func TestGetHeaderAncestorsByHash(t *testing.T) {
232232func TestGetCommonAncestor (t * testing.T ) {
233233 t .Run ("failure when authorization on and empty auth header" , func (t * testing.T ) {
234234 // given
235- bhs , cleanup := testapp .NewTestBlockHeaderService (t )
235+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp . WithRandomPort () )
236236 defer cleanup ()
237237 expectedResult := struct {
238238 code int
@@ -252,7 +252,7 @@ func TestGetCommonAncestor(t *testing.T) {
252252
253253 t .Run ("success" , func (t * testing.T ) {
254254 // given
255- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
255+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
256256 defer cleanup ()
257257 genesis := chaincfg .MainNetParams .GenesisBlock .Header
258258 expectedResponse := headers.BlockHeaderResponse {
@@ -287,7 +287,7 @@ func TestGetCommonAncestor(t *testing.T) {
287287
288288 t .Run ("failure - hash not found" , func (t * testing.T ) {
289289 // given
290- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
290+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
291291 defer cleanup ()
292292 expectedResult := struct {
293293 code int
@@ -309,7 +309,7 @@ func TestGetCommonAncestor(t *testing.T) {
309309func TestGetHeadersState (t * testing.T ) {
310310 t .Run ("failure when authorization on and empty auth header" , func (t * testing.T ) {
311311 // given
312- bhs , cleanup := testapp .NewTestBlockHeaderService (t )
312+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp . WithRandomPort () )
313313 defer cleanup ()
314314 expectedResult := struct {
315315 code int
@@ -329,7 +329,7 @@ func TestGetHeadersState(t *testing.T) {
329329
330330 t .Run ("success" , func (t * testing.T ) {
331331 // given
332- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
332+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
333333 defer cleanup ()
334334 expectedResponse := headers.BlockHeaderStateResponse {
335335 Header : expectedObj ,
@@ -359,7 +359,7 @@ func TestGetHeadersState(t *testing.T) {
359359
360360 t .Run ("failure - hash not found" , func (t * testing.T ) {
361361 // given
362- bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
362+ bhs , cleanup := testapp .NewTestBlockHeaderService (t , testapp .WithRandomPort (), testapp . WithLongestChain (), testapp .WithAPIAuthorizationDisabled ())
363363 defer cleanup ()
364364 expectedResult := struct {
365365 code int
0 commit comments