diff --git a/e2e/getdents/getdents_test.go b/e2e/getdents/getdents_test.go index b8a9459c0d..1a8bff1969 100644 --- a/e2e/getdents/getdents_test.go +++ b/e2e/getdents/getdents_test.go @@ -76,7 +76,7 @@ func TestGetDEnts(t *testing.T) { stdout, stderr, err := ct.Kubeclient.Exec(ctx, ct.Namespace, pods[0].Name, []string{"/bin/sh", "-c", "find /toomany | wc -l"}) require.NoError(err, "stderr: %q", stderr) - require.Equal(stdout, "10001\n", "output: %s", stdout) + require.Equal("10001\n", stdout, "output: %s", stdout) }) } diff --git a/e2e/release/release_test.go b/e2e/release/release_test.go index 7561789649..802ffca9de 100644 --- a/e2e/release/release_test.go +++ b/e2e/release/release_test.go @@ -50,7 +50,7 @@ func TestRelease(t *testing.T) { contrast := &contrast{dir} for _, sub := range []string{"help"} { - contrast.Run(t, ctx, 2*time.Second, sub) + contrast.Run(ctx, t, 2*time.Second, sub) } t.Cleanup(func() { @@ -79,7 +79,9 @@ func TestRelease(t *testing.T) { // Delete resources 1-by-1 so that we don't stop on errors. for _, resource := range resources { - k.Delete(ctx, resource) + if err := k.Delete(ctx, resource); err != nil { + t.Logf("deleting resource %s: %v", resource.GetName(), err) + } } }) @@ -136,9 +138,9 @@ func TestRelease(t *testing.T) { } }), "unpacking needs to succeed for subsequent tests to run") - contrast.Run(t, ctx, 2*time.Minute, "generate", "deployment/") - contrast.Run(t, ctx, 1*time.Minute, "set", "-c", coordinatorIP+":1313", "deployment/") - contrast.Run(t, ctx, 1*time.Minute, "verify", "-c", coordinatorIP+":1313") + contrast.Run(ctx, t, 2*time.Minute, "generate", "deployment/") + contrast.Run(ctx, t, 1*time.Minute, "set", "-c", coordinatorIP+":1313", "deployment/") + contrast.Run(ctx, t, 1*time.Minute, "verify", "-c", coordinatorIP+":1313") require.True(t, t.Run("apply-demo", func(t *testing.T) { require := require.New(t) @@ -176,7 +178,7 @@ func TestRelease(t *testing.T) { c := http.Client{ Transport: &http.Transport{ - DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { + DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) { return (&net.Dialer{}).DialContext(ctx, "tcp", net.JoinHostPort(emojiwebIP, "443")) }, TLSClientConfig: cfg, @@ -186,6 +188,7 @@ func TestRelease(t *testing.T) { require.NoError(err) resp, err := c.Do(req) require.NoError(err) + defer resp.Body.Close() require.Equal(http.StatusOK, resp.StatusCode) }) } @@ -194,7 +197,7 @@ type contrast struct { dir string } -func (c *contrast) Run(t *testing.T, ctx context.Context, timeout time.Duration, args ...string) { +func (c *contrast) Run(ctx context.Context, t *testing.T, timeout time.Duration, args ...string) { require.True(t, t.Run(args[0], func(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() diff --git a/e2e/servicemesh/servicemesh_test.go b/e2e/servicemesh/servicemesh_test.go index 852cdde504..8787bde7fa 100644 --- a/e2e/servicemesh/servicemesh_test.go +++ b/e2e/servicemesh/servicemesh_test.go @@ -77,7 +77,7 @@ func TestIngressEgress(t *testing.T) { tlsConf := &tls.Config{RootCAs: pool} hc := &http.Client{Transport: &http.Transport{TLSClientConfig: tlsConf}} - req, err := http.NewRequest("GET", fmt.Sprintf("https://%s/", web), nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("https://%s/", web), http.NoBody) require.NoError(err) resp, err := hc.Do(req) require.NoError(err)