Harden host deletion and test stability
This commit is contained in:
@@ -1545,11 +1545,13 @@ func TestActionSetHostClosuresAndAccessPreview(t *testing.T) {
|
||||
t.Fatalf("AccessPreview(subscription) = %+v, want available=false", preview)
|
||||
}
|
||||
|
||||
if err := actions.DeleteHost(context.Background(), "host-main"); err != nil {
|
||||
t.Fatalf("DeleteHost() error = %v", err)
|
||||
}
|
||||
if _, err := store.Hosts().GetByHostID(context.Background(), "host-main"); err == nil {
|
||||
t.Fatal("DeleteHost() did not remove host-main")
|
||||
if err := actions.DeleteHost(context.Background(), "host-main"); err == nil {
|
||||
t.Fatal("DeleteHost() error = nil, want host_in_use conflict")
|
||||
} else {
|
||||
httpErr, ok := err.(*httpError)
|
||||
if !ok || httpErr.StatusCode != http.StatusConflict || httpErr.Code != "host_in_use" {
|
||||
t.Fatalf("DeleteHost() error = %T %v, want *httpError host_in_use conflict", err, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user