@@ -68,6 +68,7 @@ func RegisterSteps(sc *godog.ScenarioContext) {
6868 sc .Step (`^(?i)resource "([^"]+)" is installed$` , ResourceAvailable )
6969 sc .Step (`^(?i)resource "([^"]+)" is available$` , ResourceAvailable )
7070 sc .Step (`^(?i)resource "([^"]+)" is removed$` , ResourceRemoved )
71+ sc .Step (`^(?i)resource "([^"]+)" is eventually not found$` , ResourceEventuallyNotFound )
7172 sc .Step (`^(?i)resource "([^"]+)" exists$` , ResourceAvailable )
7273 sc .Step (`^(?i)resource is applied$` , ResourceIsApplied )
7374 sc .Step (`^(?i)resource "deployment/test-operator" reports as (not ready|ready)$` , MarkTestOperatorNotReady )
@@ -411,6 +412,7 @@ func ResourceAvailable(ctx context.Context, resource string) error {
411412
412413func ResourceRemoved (ctx context.Context , resource string ) error {
413414 sc := scenarioCtx (ctx )
415+ resource = substituteScenarioVars (resource , sc )
414416 rtype , name , found := strings .Cut (resource , "/" )
415417 if ! found {
416418 return fmt .Errorf ("resource %s is not in the format <type>/<name>" , resource )
@@ -428,6 +430,21 @@ func ResourceRemoved(ctx context.Context, resource string) error {
428430 return err
429431}
430432
433+ func ResourceEventuallyNotFound (ctx context.Context , resource string ) error {
434+ sc := scenarioCtx (ctx )
435+ resource = substituteScenarioVars (resource , sc )
436+ rtype , name , found := strings .Cut (resource , "/" )
437+ if ! found {
438+ return fmt .Errorf ("resource %s is not in the format <type>/<name>" , resource )
439+ }
440+
441+ require .Eventually (godog .T (ctx ), func () bool {
442+ obj , err := k8sClient ("get" , rtype , name , "-n" , sc .namespace , "--ignore-not-found" , "-o" , "yaml" )
443+ return err == nil && obj == ""
444+ }, timeout , tick )
445+ return nil
446+ }
447+
431448func ResourceMatches (ctx context.Context , resource string , requiredContentTemplate * godog.DocString ) error {
432449 sc := scenarioCtx (ctx )
433450 resource = substituteScenarioVars (resource , sc )
@@ -468,6 +485,7 @@ func ResourceMatches(ctx context.Context, resource string, requiredContentTempla
468485
469486func ResourceRestored (ctx context.Context , resource string ) error {
470487 sc := scenarioCtx (ctx )
488+ resource = substituteScenarioVars (resource , sc )
471489 rtype , name , found := strings .Cut (resource , "/" )
472490 if ! found {
473491 return fmt .Errorf ("resource %s is not in the format <type>/<name>" , resource )
0 commit comments