Skip to content

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
Member

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
Member

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