1- // Copyright (c) 2019-2025 Red Hat, Inc.
1+ // Copyright (c) 2019-2026 Red Hat, Inc.
22// Licensed under the Apache License, Version 2.0 (the "License");
33// you may not use this file except in compliance with the License.
44// You may obtain a copy of the License at
@@ -22,9 +22,17 @@ import (
2222 "github.com/onsi/ginkgo/v2"
2323)
2424
25- var _ = ginkgo .Describe ("[DevWorkspace Debug Start Mode]" , func () {
25+ var _ = ginkgo .Describe ("[DevWorkspace Debug Start Mode]" , ginkgo . Ordered , func () {
2626 defer ginkgo .GinkgoRecover ()
2727
28+ const workspaceName = "code-latest-with-debug-start"
29+
30+ ginkgo .AfterAll (func () {
31+ // Clean up workspace and wait for PVC to be fully deleted
32+ // This prevents PVC conflicts in subsequent tests, especially in CI environments
33+ _ = config .DevK8sClient .DeleteDevWorkspaceAndWait (workspaceName , config .DevWorkspaceNamespace )
34+ })
35+
2836 ginkgo .It ("Wait DevWorkspace Webhook Server Pod" , func () {
2937 controllerLabel := "app.kubernetes.io/name=devworkspace-webhook-server"
3038
@@ -39,26 +47,26 @@ var _ = ginkgo.Describe("[DevWorkspace Debug Start Mode]", func() {
3947 }
4048 })
4149
42- ginkgo .It ("Add Debug DevWorkspace to cluster and wait starting status" , func () {
50+ ginkgo .It ("Add Debug DevWorkspace to cluster and wait running status" , func () {
4351 commandResult , err := config .DevK8sClient .OcApplyWorkspace (config .DevWorkspaceNamespace , "test/resources/simple-devworkspace-debug-start-annotation.yaml" )
4452 if err != nil {
4553 ginkgo .Fail (fmt .Sprintf ("Failed to create DevWorkspace: %s %s" , err .Error (), commandResult ))
4654 return
4755 }
4856
49- deploy , err := config .DevK8sClient .WaitDevWsStatus ("code-latest-with-debug-start" , config .DevWorkspaceNamespace , dw .DevWorkspaceStatusStarting )
57+ deploy , err := config .DevK8sClient .WaitDevWsStatus (workspaceName , config .DevWorkspaceNamespace , dw .DevWorkspaceStatusRunning )
5058 if ! deploy {
5159 ginkgo .Fail (fmt .Sprintf ("DevWorkspace didn't start properly. Error: %s" , err ))
5260 }
5361 })
5462
5563 ginkgo .It ("Check DevWorkspace Conditions for Debug Start message" , func () {
56- devWorkspaceStatus , err := config .DevK8sClient .GetDevWsStatus ("code-latest-with-debug-start" , config .DevWorkspaceNamespace )
64+ devWorkspaceStatus , err := config .DevK8sClient .GetDevWsStatus (workspaceName , config .DevWorkspaceNamespace )
5765 if err != nil {
5866 ginkgo .Fail (fmt .Sprintf ("Failure in fetching DevWorkspace status. Error: %s" , err ))
5967 }
6068
61- expectedSubstring := "Debug mode: failed postStart commands will be trapped; inspect logs/exec to debug"
69+ expectedSubstring := "DevWorkspace is starting in debug mode "
6270
6371 found := false
6472 for _ , cond := range devWorkspaceStatus .Conditions {
0 commit comments