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

tests: pubsub: fix flakiness #759

Merged

Conversation

stephenplusplus
Copy link
Contributor

We've had issues with Pub/Sub tests flaking out, and today we ran into them again: https://travis-ci.org/GoogleCloudPlatform/gcloud-node/builds/73278785#L3237

What appears to be happening is when we pull for a message with returnImmediately:false, no messages are ever returned, and the test times out.

History:
#332
#377

The way it was working until today seemed cleaner, which was basically:

publishMessage(function() {
  pullMessage(function() {
    // run tests about the message here
  })
})

We used to run them like this:

pullMessage(function() {
  // long-running until a message returns
})

publishMessage() x exactly 6

This PR runs them like this:

beforeTestsRun(function() {
  publishMessage() x 10
})

test(function() {
  pullMessage(function() {
    // run tests about the message here
  })
})

test(function() {
  pullMessage(function() {
    // run tests about the message here
  })
})

// etc...

I played with the ordering of publishes and pulls, with returnImmediately to true and false, with different amounts of messages (anywhere from 1-10), with publishing multiple messages in one API call vs many, and this was the only combination of all of the above that I could find that worked.

@tmatsuo -- your wisdom is very welcome :)

@stephenplusplus stephenplusplus added api: pubsub Issues related to the Pub/Sub API. testing labels Jul 30, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 30, 2015
@callmehiphop
Copy link
Contributor

Looks good to me!

stephenplusplus added a commit that referenced this pull request Jul 30, 2015
@stephenplusplus stephenplusplus merged commit 5ea6403 into googleapis:master Jul 30, 2015
sofisl added a commit that referenced this pull request Nov 9, 2022
Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants