Skip to content

Commit

Permalink
Correctly use subtests in helm template tests
Browse files Browse the repository at this point in the history
The testing.T in the subtest wasn't being used, so subtests were
effectively not being used. Additionally, in case subtests run in
parallel, we assign tt := tt to fix closure captures on range variables,
since the variables produced by a range are re-used between iterations.
  • Loading branch information
Chance Zibolski committed Apr 11, 2018
1 parent ced20f6 commit b9adc35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/helm/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ func TestTemplateCmd(t *testing.T) {

var buf bytes.Buffer
for _, tt := range tests {
t.Run(tt.name, func(T *testing.T) {
tt := tt
t.Run(tt.name, func(t *testing.T) {
// capture stdout
old := os.Stdout
r, w, _ := os.Pipe()
Expand Down

0 comments on commit b9adc35

Please sign in to comment.