Skip to content

Commit

Permalink
VAULT-1618 Move cancel and server stop into defer in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Swenson committed Mar 10, 2022
1 parent 6362c68 commit b13ad32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions command/agent/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ func TestNewServerLogLevels(t *testing.T) {
if server == nil {
t.Fatal("nil server returned")
}
defer server.Stop()

templateTokenCh := make(chan string, 1)

Expand All @@ -446,6 +447,7 @@ func TestNewServerLogLevels(t *testing.T) {
templatesToRender := []*ctconfig.TemplateConfig{templateTest}

ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()

errCh := make(chan error)
go func() {
Expand All @@ -463,8 +465,6 @@ func TestNewServerLogLevels(t *testing.T) {
t.Fatalf("did not expect error, got: %v", err)
}
}
cancel()
server.Stop()
})
}
}
Expand Down

0 comments on commit b13ad32

Please sign in to comment.