mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user