Skip to content

Commit

Permalink
Change trigger requirement phases
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul-Kumar-prog committed May 28, 2024
1 parent fa46a45 commit 0917cb0
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions test/rekt/features/trigger/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,22 @@ func TriggerWithTLSSubscriber() *feature.Feature {
trigger.Install(triggerName, brokerName,
trigger.WithSubscriberFromDestination(subscriber))(ctx, t)
})
f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName))

f.Requirement("Wait for Trigger to become ready", trigger.IsReady(triggerName))

f.Setup("trigger is not ready", func(ctx context.Context, t feature.T) {
trigger, err := trigger.Get(ctx, triggerName)

Check failure on line 133 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

undefined: trigger.Get

Check failure on line 133 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: trigger.Get

Check failure on line 133 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: trigger.Get

Check failure on line 133 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

undefined: trigger.Get
if err != nil {
t.Fatalf("Failed to get Trigger: %v", err)
}
if trigger.Status.IsReady() {
t.Fatalf("Trigger is ready when it should not be")
}
reason := trigger.Status.GetCondition(apis.ConditionReady).reason
if reason != "DependencyDoesNotExist" {
t.Fatalf("expected reason to be DependencyDoesNotExist but got: %v", reason)
}
})

f.Setup("Install failing trigger", func(ctx context.Context, t feature.T) {
dls := service.AsDestinationRef(dlsName)
Expand All @@ -138,6 +153,21 @@ func TriggerWithTLSSubscriber() *feature.Feature {
trigger.WithDeadLetterSinkFromDestination(dls),
trigger.WithSubscriber(nil, "http://127.0.0.1:2468"))(ctx, t)
})
f.Requirement("Wait for failing Trigger to become ready", trigger.IsReady(dlsTriggerName))

f.Setup("Failed trigger is not ready", func(ctx context.Context, t feature.T) {
trigger, err := trigger.Get(ctx, dlsTriggerName)

Check failure on line 159 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

undefined: trigger.Get

Check failure on line 159 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: trigger.Get

Check failure on line 159 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: trigger.Get

Check failure on line 159 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

undefined: trigger.Get
if err != nil {
t.Fatalf("Failed to get Trigger: %v", err)
}
if trigger.Status.IsReady() {
t.Fatalf("Failed Trigger is ready when it should not be")
}
reason := trigger.Status.GetCondition(apis.ConditionReady).reason
if reason != "DependencyDoesNotExist" {
t.Fatalf("expected reason to be DependencyDoesNotExist but got: %v", reason)
}
})
f.Setup("Wait for failing Trigger to become ready", trigger.IsReady(dlsTriggerName))

// Install Source
Expand Down Expand Up @@ -199,7 +229,22 @@ func TriggerWithTLSSubscriberTrustBundle() *feature.Feature {
trigger.Install(triggerName, brokerName,
trigger.WithSubscriberFromDestination(subscriber))(ctx, t)
})
f.Setup("Wait for Trigger to become ready", trigger.IsReady(triggerName))

f.Requirement("Wait for failing Trigger to become ready", trigger.IsReady(triggerName))

f.Setup("Failed trigger is not ready", func(ctx context.Context, t feature.T) {
trigger, err := trigger.Get(ctx, triggerName)

Check failure on line 236 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Go vulnerability Detection

undefined: trigger.Get

Check failure on line 236 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / build / Build

undefined: trigger.Get

Check failure on line 236 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: trigger.Get

Check failure on line 236 in test/rekt/features/trigger/feature.go

View workflow job for this annotation

GitHub Actions / analyze / Analyze CodeQL

undefined: trigger.Get
if err != nil {
t.Fatalf("Failed to get Trigger: %v", err)
}
if trigger.Status.IsReady() {
t.Fatalf("Failed Trigger is ready when it should not be")
}
reason := trigger.Status.GetCondition(apis.ConditionReady).reason
if reason != "DependencyDoesNotExist" {
t.Fatalf("expected reason to be DependencyDoesNotExist but got: %v", reason)
}
})

f.Setup("Install failing trigger", func(ctx context.Context, t feature.T) {
dls := &duckv1.Destination{
Expand Down

0 comments on commit 0917cb0

Please sign in to comment.