Skip to content

Commit 1f8054b

Browse files
utam0kroboquat
authored andcommitted
tests: Clean a workspace even if a test failed
1 parent e50616a commit 1f8054b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/tests/workspace/docker_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ func TestRunDocker(t *testing.T) {
3232
if err != nil {
3333
t.Fatal(err)
3434
}
35+
t.Cleanup(func() {
36+
err = integration.DeleteWorkspace(ctx, api, ws.Req.Id)
37+
if err != nil {
38+
t.Fatal(err)
39+
}
40+
_, _ = integration.WaitForWorkspaceStop(ctx, api, ws.Req.Id)
41+
})
3542

3643
rsa, closer, err := integration.Instrument(integration.ComponentWorkspace, "workspace", cfg.Namespace(), kubeconfig, cfg.Client(), integration.WithInstanceID(ws.Req.Id), integration.WithWorkspacekitLift(true))
3744
if err != nil {
@@ -57,11 +64,6 @@ func TestRunDocker(t *testing.T) {
5764
t.Fatalf("docker run failed: %s\n%s", resp.Stdout, resp.Stderr)
5865
}
5966

60-
err = integration.DeleteWorkspace(ctx, api, ws.Req.Id)
61-
if err != nil {
62-
t.Fatal(err)
63-
}
64-
6567
return ctx
6668
}).
6769
Feature()

0 commit comments

Comments
 (0)