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

chore: address test flakes #249

Merged
merged 6 commits into from
Nov 20, 2023
Merged

chore: address test flakes #249

merged 6 commits into from
Nov 20, 2023

Conversation

willmurphyscode
Copy link
Contributor

@willmurphyscode willmurphyscode commented Nov 20, 2023

There seem to be a few things happening:

  1. We sometimes hit jest timeouts.
  2. We sometimes hit spawn ETXTBSY from Node, which means that we tried to exec a file that is also open for writing. I think this is a race condition where one test is running grype while another is installing it.
  3. We sometimes have an error like: couldn't exec grype: is the filename correct and the file marked as executable? (Like this: https://github.com/anchore/scan-action/actions/runs/6931060595/job/18851984035#step:8:144). I think this is also a race WRT to installing grype.

Therefore:

  • bump jest timeout from 30s to 90s. Downloading grype and grype DB can take some time, so this seems reasonable
  • Install grype in a beforeAll, so that when the individual tests run grype, it's already there, so hopefully no one will race to install it.

We're seeing this timeout triggered in CI.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Otherwise, we'd run tests twice for each PR; once because it was a PR, and once
because someone pushed to a branch.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
Signed-off-by: Will Murphy <will.murphy@anchore.com>
@willmurphyscode willmurphyscode changed the title chore: bump jest timeout chore: address test flakes Nov 20, 2023
@willmurphyscode willmurphyscode marked this pull request as ready for review November 20, 2023 14:17
Copy link
Contributor

@wagoodman wagoodman left a comment

Choose a reason for hiding this comment

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

mind adding a comment around the timeouts (could link to the PR or a short 1 sentence explanation... or both)?

Signed-off-by: Will Murphy <will.murphy@anchore.com>
@willmurphyscode willmurphyscode merged commit 62370b5 into main Nov 20, 2023
13 checks passed
@willmurphyscode willmurphyscode deleted the chore/address-test-flake branch November 20, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants