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: fix flaky test-webcrypto-encrypt-decrypt-aes #37373

Closed
wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Feb 15, 2021

Use Object.assign() to make shallow copies of the object passed to the
test functions. The test functions are passed to Promise.all() so
execution order is not guaranteed. So using the same object in all of
them is a race condition where one test can have side effects in
another.

Fixes: #35586

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Feb 15, 2021
@nodejs-github-bot
Copy link
Collaborator

@Trott Trott changed the title test: fix flaky test-webcrypto-encrypt-decrypt-aes on rhe17-s390x test: fix flaky test-webcrypto-encrypt-decrypt-aes Feb 15, 2021
Use Object.assign() to make shallow copies of the object passed to the
test functions. The test functions are passed to Promise.all() so
execution order is not guaranteed. So using the same object in all of
them is a race condition where one test can have side effects in
another.

Fixes: nodejs#35586
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Feb 15, 2021

Are these objects modified by the test or by core APIs?

@RaisinTen
Copy link
Contributor

Are these objects modified by the test or by core APIs?

@targos Yes, the contents of plaintext is modified here:

plaintext[0] = 255 - plaintext[0];

@targos
Copy link
Member

targos commented Feb 15, 2021

Oh, but if we're modifying the contents of the plaintext property, a shallow copy is not going to help here.

@Trott
Copy link
Member Author

Trott commented Feb 15, 2021

Oh, but if we're modifying the contents of the plaintext property, a shallow copy is not going to help here.

🤦‍♂️ I'll run a stress test to confirm, and then make a shallow copy of the property to confirm that fixes it.

@RaisinTen
Copy link
Contributor

I think something is wrong inside the function too and I think this will be a fix: #37380

@Trott Trott closed this Feb 15, 2021
@Trott Trott deleted the fix-webcrypto branch September 25, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate flaky test-webcrypto-encrypt-decrypt-aes on rhe17-s390x
4 participants