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

feat: implementing mocha retries #1295

Merged
merged 13 commits into from
Nov 2, 2023
Merged

feat: implementing mocha retries #1295

merged 13 commits into from
Nov 2, 2023

Conversation

loferris
Copy link
Contributor

@loferris loferris commented Oct 23, 2023

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1299 🦕

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Oct 23, 2023
@conventional-commit-lint-gcf
Copy link

conventional-commit-lint-gcf bot commented Oct 23, 2023

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/nodejs-bigquery API. label Oct 23, 2023
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: m Pull request size is medium. labels Oct 25, 2023
@loferris loferris marked this pull request as ready for review October 25, 2023 04:05
@loferris loferris requested review from a team as code owners October 25, 2023 04:05
@loferris loferris added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. owlbot:run Add this label to trigger the Owlbot post processor. labels Oct 25, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Oct 25, 2023
@loferris loferris added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Oct 25, 2023
@loferris loferris self-assigned this Oct 25, 2023
Copy link
Contributor

@alvarowolfx alvarowolfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment on how to make retries more granular and efficient.

@@ -36,7 +36,8 @@ const sharedViewId = generateUuid();

const bigquery = new BigQuery();

describe('Authorized View Tutorial', () => {
describe('Authorized View Tutorial', function () {
this.retries(3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think doing this way, it will retry the whole describe section, which can be quite expensive to re run. I ran some tests here and seems like we can retry on a per spec basis.

describe('Authorized View Tutorial', () => { // Back to arrow function
  beforeEach(function(){
    console.log("this:", this.currentTest.title)
    this.currentTest.retries(2); // will try 3 times - n+1    
  })

Then I changed one of the tests to fail, to check for the retry behavior:

  it('should query stackoverflow', async () => {
    const output = execSync('node queryStackOverflow.js');
    assert.match(output, /Query Results:/);
    assert.match(output, /views/);
    assert.match(0,1)
  }); // Force failure

samples/test/datasets.test.js Outdated Show resolved Hide resolved
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. priority: p2 Moderately-important priority. Fix may not be included in next release. size: m Pull request size is medium. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mocha retries to testing suite for samples
3 participants