Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Conversation

@vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Sep 9, 2018

Another potential fix for #2534. This PR has successfully ran tests 5 and 10 times in a row, ref https://circleci.com/gh/mozilla/fxa-auth-server/3368.

I think part of the flaky test failures might involve proxyrequire and caching modules. When running the local and remote test suites individually I could not get the majority of errors in #2534. I thought using proxyrequire with noPreserveCache() and noCallThru() would fix the issue but I could not determine the exact modules that needed them (it is probably very time consuming as well).

To that end, this solution just splits remote and local tests and updates coverage tool to combine from both runs.

@vbudhram vbudhram added the WIP label Sep 9, 2018
@ghost ghost assigned vbudhram Sep 9, 2018
@ghost ghost added the waffle:active label Sep 9, 2018
@vbudhram vbudhram force-pushed the flake-1 branch 2 times, most recently from 6014277 to 1ab3186 Compare September 10, 2018 02:33
@vbudhram vbudhram mentioned this pull request Sep 10, 2018
op: 'promise.unhandledRejection',
error: reason
})
process.exit(8)
Copy link
Contributor

Choose a reason for hiding this comment

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

We had this before in the auth-server, but had to remove it in prod because prod would get unhandledRejections

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was added while narrowing down possible issues. Consider it gone!

@vbudhram vbudhram force-pushed the flake-1 branch 2 times, most recently from ff7a723 to 24c963e Compare September 10, 2018 17:32
return db.forgotPasswordVerified(passwordForgotToken)
.then(accountResetToken => {
assert.ok(accountResetToken.createdAt > passwordForgotToken.createdAt, 'account reset token should be newer than password forgot token')
assert.ok(accountResetToken.createdAt >= passwordForgotToken.createdAt, 'account reset token should be equal or newer than password forgot token')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes #2534 (comment), where I think the reset token has the same timestamp as forgot token since it gets create right next to each other. I could have added a delay here but opted to just test that they were >= since a they could have same timestamp.

@vbudhram vbudhram changed the title fix(tests): flake test 1 fix(tests): split running remote and local tests Sep 10, 2018
@vbudhram
Copy link
Contributor Author

@mozilla/fxa-devs No rush on this, r?

Copy link
Contributor

@philbooth philbooth left a comment

Choose a reason for hiding this comment

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

All looks fine to me. The module cache is weird, so I'm not surprised proxyquire can cause us problems. Presumably if we forced noPreserveCache() everywhere it would also get it working, but that's a much heavier change so I'm cool with doing this instead.

"npmshrink": "1.0.1",
"nyc": "13.0.0",
"proxyquire": "1.8.0",
"proxyquire": "2.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Purely for my own curiosity, are there any cool new features/fixes we're getting with this upgrade or is it just to get us on the latest and greatest generally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this upgrade just had bug fixes. I thought they might resolve some of the flaky test but didn't.


let bin = NYC_BIN
let argv = ['--cache', MOCHA_BIN]
let argv = ['--cache', '--no-clean', MOCHA_BIN]
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this do? (purely for my own curiosity, again)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The --no-clean does not remove coverage files from previous runs. Since I split the test runs, it generates the coverage data as if it was run in one operation.

@vbudhram vbudhram merged commit d13b455 into master Sep 11, 2018
@ghost ghost removed the waffle:review label Sep 11, 2018
@philbooth philbooth deleted the flake-1 branch September 11, 2018 12:50
@vbudhram
Copy link
Contributor Author

@philbooth Thanks for r!

Presumably if we forced noPreserveCache() everywhere it would also get it working

Unfortunately, I tried that and didn't get much luck. A bunch of tests started failing for various reasons. Longer term maybe there is something better than proxyquire that we could use?

@philbooth
Copy link
Contributor

Longer term maybe there is something better than proxyquire that we could use?

Before I joined this team I always used to use mockery for the same purpose. But it's entirely possible that it would suffer from the same issue, they're both hacking the module cache at the end of the day.

@shane-tomlinson
Copy link

Before I joined this team I always used to use mockery for the same purpose. But it's entirely possible that it would suffer from the same issue, they're both hacking the module cache at the end of the day.

I wonder if proxyquire could be one source of troubles with the behavior I saw in @deeptibaghel's profile-server PR to update to Hapi 17, I commented over in another PR it's almost like the require cache is being used w/ hapi 17, but wasn't before.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants