diff --git a/internal/integration/integration_test.go b/internal/integration/integration_test.go index 1b6e4dca..b40cdcd3 100644 --- a/internal/integration/integration_test.go +++ b/internal/integration/integration_test.go @@ -57,7 +57,7 @@ func TestMutation(t *testing.T) { require.Errorf(t, err, "client does not support mutations") } -type subscriptionCountResult struct { +type subscriptionResult struct { clientUnsubscribed bool serverChannelClosed bool } @@ -67,35 +67,34 @@ func TestSubscription(t *testing.T) { subscription count { count }` ctx := context.Background() + server := server.RunServer() + defer server.Close() cases := []struct { name string unsubThreshold time.Duration - expected subscriptionCountResult + expected subscriptionResult }{ - { - name: "client_unsubscribed", - unsubThreshold: 300 * time.Millisecond, - expected: subscriptionCountResult{ - clientUnsubscribed: true, - serverChannelClosed: false, - }, - }, { name: "server_closed_channel", unsubThreshold: 5 * time.Second, - expected: subscriptionCountResult{ + expected: subscriptionResult{ clientUnsubscribed: false, serverChannelClosed: true, }, }, + { + name: "client_unsubscribed", + unsubThreshold: 300 * time.Millisecond, + expected: subscriptionResult{ + clientUnsubscribed: true, + serverChannelClosed: false, + }, + }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - server := server.RunServer() - defer server.Close() - wsClient := newRoundtripWebSocketClient(t, server.URL) errChan, err := wsClient.Start(ctx) require.NoError(t, err) @@ -107,7 +106,7 @@ func TestSubscription(t *testing.T) { var ( counter = 0 start = time.Now() - result = subscriptionCountResult{} + result = subscriptionResult{} ) for loop := true; loop; {