use t.Cleanup instead of defer

This commit is contained in:
Denis Bilenko 2024-12-02 16:04:12 +01:00
parent 80d9b6ae17
commit 42502513bf
1 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,9 @@ func TestFetchRepositoryInfoAPI(t *testing.T) {
targetPath := acc.RandomName("/Workspace/Users/" + me.UserName + "/testing-clone-bundle-examples-")
stdout, stderr := RequireSuccessfulRun(t, "repos", "create", examplesRepoUrl, examplesRepoProvider, "--path", targetPath)
defer RequireSuccessfulRun(t, "repos", "delete", targetPath)
t.Cleanup(func() {
RequireSuccessfulRun(t, "repos", "delete", targetPath)
})
assert.Empty(t, stderr.String())
assert.NotEmpty(t, stdout.String())