diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-08-06 09:39:56 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2020-08-06 09:39:56 +0300 |
commit | a1731804961b8a57610cb9251c0938b384cbaaf0 (patch) | |
tree | 4d2a1de5bf09e149c9f1242b1b7178803b4e2a43 /client | |
parent | 0f3b4b0b121f611fac2a613ec0273864d5f38c8b (diff) |
Feature flags enabling for tests.
It is decided to go with all features enabled by default behaviour
for tests. This should help us identify potential problems with
feature flag combinations enabled in production. To verify implementation
without feature flag enabled it should be disabled explicitly in the
test.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2702
Diffstat (limited to 'client')
-rw-r--r-- | client/dial_test.go | 9 | ||||
-rw-r--r-- | client/pool_test.go | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/client/dial_test.go b/client/dial_test.go index 2759e2dde..05015df62 100644 --- a/client/dial_test.go +++ b/client/dial_test.go @@ -21,7 +21,7 @@ import ( var proxyEnvironmentKeys = []string{"http_proxy", "https_proxy", "no_proxy"} -func doDialAndExecuteCall(addr string) error { +func doDialAndExecuteCall(ctx context.Context, addr string) error { conn, err := Dial(addr, nil) if err != nil { return fmt.Errorf("dial: %v", err) @@ -29,7 +29,7 @@ func doDialAndExecuteCall(addr string) error { defer conn.Close() client := healthpb.NewHealthClient(conn) - _, err = client.Check(context.Background(), &healthpb.HealthCheckRequest{}) + _, err = client.Check(ctx, &healthpb.HealthCheckRequest{}) return err } @@ -113,7 +113,10 @@ func TestDial(t *testing.T) { defer testhelper.ModifyEnvironment(t, gitaly_x509.SSLCertFile, tt.envSSLCertFile)() } - err := doDialAndExecuteCall(tt.rawAddress) + ctx, cancel := testhelper.Context() + defer cancel() + + err := doDialAndExecuteCall(ctx, tt.rawAddress) if tt.expectFailure { require.Error(t, err) return diff --git a/client/pool_test.go b/client/pool_test.go index 99a3c3057..c7eab4fed 100644 --- a/client/pool_test.go +++ b/client/pool_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/require" gitaly_auth "gitlab.com/gitlab-org/gitaly/internal/config/auth" "gitlab.com/gitlab-org/gitaly/internal/server/auth" + "gitlab.com/gitlab-org/gitaly/internal/testhelper" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/health" @@ -130,7 +131,7 @@ func TestPoolDial(t *testing.T) { require.NoError(t, pool.Close()) }() - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := testhelper.Context(testhelper.ContextWithTimeout(time.Second)) defer cancel() tc.test(t, ctx, pool) |