fix: Fix cleanup in test helpers, prefer defer in tests (#3113)

* fix: Change uses of t.Cleanup -> defer in test bodies

Mixing t.Cleanup and defer can lead to unexpected order of execution.

* fix: Ensure t.Cleanup is not aborted by require

* chore: Add helper annotations
This commit is contained in:
Mathias Fredriksson
2022-07-25 19:22:02 +03:00
committed by GitHub
parent c2cd51d8b8
commit 6916d34458
14 changed files with 60 additions and 53 deletions
+1 -1
View File
@@ -380,7 +380,7 @@ func TestTemplateVersionLogs(t *testing.T) {
}},
})
ctx, cancelFunc := context.WithCancel(context.Background())
t.Cleanup(cancelFunc)
defer cancelFunc()
logs, err := client.TemplateVersionLogsAfter(ctx, version.ID, before)
require.NoError(t, err)
for {