Skip to content

Commit

Permalink
adding more polling for channel tests (#5284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Nichols authored Apr 20, 2021
1 parent 31cda4c commit 79e83bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/rekt/features/channel/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,24 @@ func channelAllowsSubscribersAndStatus(ctx context.Context, t feature.T) {
}

func readyChannelIsAddressable(ctx context.Context, t feature.T) {
channel := getChannelable(ctx, t)
var ch *duckv1.Channelable

if c := channel.Status.GetCondition(apis.ConditionReady); c.IsTrue() {
if channel.Status.Address.URL == nil {
// Poll for a ready channel.
interval, timeout := environment.PollTimingsFromContext(ctx)
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
ch = getChannelable(ctx, t)
if c := ch.Status.GetCondition(apis.ConditionReady); c.IsTrue() {
return true, nil
}
return false, nil
})
if err != nil {
t.Fatalf("failed to get a ready channel", err)
}

// Confirm the channel is ready, and addressable.
if c := ch.Status.GetCondition(apis.ConditionReady); c.IsTrue() {
if ch.Status.Address.URL == nil {
t.Errorf("channel is not addressable")
}
// Success!
Expand Down
2 changes: 2 additions & 0 deletions test/rekt/features/channel/data_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func DataPlaneChannel(channelName string) *feature.Feature {

f.Setup("Set Channel Name", setChannelableName(channelName))

f.Requirement("Channel is Ready", channel_impl.IsReady(channelName))

f.Stable("Input").
Must("Every Channel MUST expose either an HTTP or HTTPS endpoint.", todo).
Must("The endpoint(s) MUST conform to 0.3 or 1.0 CloudEvents specification.",
Expand Down

0 comments on commit 79e83bd

Please sign in to comment.