Skip to content

Commit

Permalink
e2e: fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Meyer <[email protected]>
  • Loading branch information
katexochen committed Jul 10, 2024
1 parent 3790b5f commit 239bc0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion e2e/getdents/getdents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down
17 changes: 10 additions & 7 deletions e2e/release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
}
}
})

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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)
})
}
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion e2e/servicemesh/servicemesh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 239bc0c

Please sign in to comment.