Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(pubsublite): fix flaky TestIntegration_SeekSubscription #8479

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions pubsublite/pscompat/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,6 @@ func TestIntegration_SeekSubscription(t *testing.T) {
createSubscription(ctx, t, admin, subscriptionPath, topicPath)
defer cleanUpSubscription(ctx, t, admin, subscriptionPath)

var msgBatch3 []string
var publishTimes3 *publishTimeRange

// Note: Subtests need to be run sequentially.

t.Run("SeekToBeginning", func(t *testing.T) {
Expand Down Expand Up @@ -996,25 +993,8 @@ func TestIntegration_SeekSubscription(t *testing.T) {

// Publish batch 3 and verify that messages are only received from batch 3
// (batch 2 skipped).
msgBatch3 = publishPrefixedMessages(t, DefaultPublishSettings, topicPath, "seek-batch3", messageCount, 0)
publishTimes3 = receiveAllMessages(t, makeMsgTracker(msgBatch3), recvSettings, subscriptionPath)

if seekOp != nil {
validateCompleteSeekOperation(ctx, t, subscriptionPath, seekOp)
}
})

t.Run("SeekToPublishTime", func(t *testing.T) {
// Seek to min publish time of batch 3.
seekOp, err := admin.SeekSubscription(ctx, subscriptionPath.String(), pubsublite.PublishTime(publishTimes3.Min()))
if err != nil {
t.Errorf("SeekSubscription() got err: %v", err)
} else {
validateNewSeekOperation(t, subscriptionPath, seekOp)
}

// Verify that messages are received from batch 3.
receiveAllMessages(t, makeMsgTracker(msgBatch3), recvSettings, subscriptionPath)
msgBatch := publishPrefixedMessages(t, DefaultPublishSettings, topicPath, "seek-batch3", messageCount, 0)
receiveAllMessages(t, makeMsgTracker(msgBatch), recvSettings, subscriptionPath)

if seekOp != nil {
validateCompleteSeekOperation(ctx, t, subscriptionPath, seekOp)
Expand Down