Skip to content

Commit

Permalink
Fix retryAfter experimental e2e test (#7148)
Browse files Browse the repository at this point in the history
  • Loading branch information
creydr authored Aug 4, 2023
1 parent 0fd9aa1 commit 37a5651
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/experimental/features/retry_after/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ func SendEvent(ctx context.Context, t *testing.T) *feature.Feature {
// Create A New Feature To Send An Event And Verify Retry-After Duration
f := feature.NewFeatureNamed("Send Events")
f.Setup("Install An EventsHub Sender", eventshub.Install(senderName, eventshub.StartSenderToResource(channel.GVR(), channelName), eventshub.InputEvent(event)))
f.Assert("Events Received", assert.OnStore(receiverName).MatchEvent(cetest.HasId(event.ID())).Exact(retryAttempts+1)) // One Successful Response
f.Assert("Event Timing Verified", assert.OnStore(receiverName).
f.Assert("Rejected Events Received", assert.OnStore(receiverName).MatchRejectedEvent(cetest.HasId(event.ID())).Exact(retryAttempts)) // `retryAttempts` dropped events
f.Assert("Received Events Received", assert.OnStore(receiverName).MatchReceivedEvent(cetest.HasId(event.ID())).Exact(1)) // One Successful Response
f.Assert("Event Timing Verified of received event", assert.OnStore(receiverName).
Match(receivedAtRegularInterval(event.ID(), time.Duration(retryAfterSeconds)*time.Second, time.Duration(expectedIntervalMargin)*time.Second)).Exact(retryAttempts+1))

// Return The SendEvents Feature
Expand Down Expand Up @@ -179,6 +180,10 @@ func receivedAtRegularInterval(id string, wait time.Duration, errorMarging time.
return nil
}

if eventInfo.Kind != assert.EventReceived {
return nil
}

if eventInfo.Time.Before(expected) {
return fmt.Errorf("response received at %s, it should have waited until %s",
eventInfo.Time.String(), expected.String())
Expand Down

0 comments on commit 37a5651

Please sign in to comment.