-
Notifications
You must be signed in to change notification settings - Fork 77
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
flaky tests in GitHub actions #265
Comments
We might be able to get away with just running one test at a time as a cheap way to fix this: With I'll see if maxConcurrency = 1 fixes this. |
Forgive the possibly ill-informed comment here. Would it be possible to pre-cache the grype-db in an early step before we kick off the further steps that may depend on it? |
I think maybe we want to use this @popey I believe the race condition occurs installing grype itself, not downloading the grype-db. Your suggestion still stands, and that might be the way forward, but I think given how quick the tests are, running the serially is probably a quicker fix and we'll try that first. |
I think it should already be set to run serially: https://github.com/anchore/scan-action/blob/main/jest.config.js#L4 |
Here's an example from sbom-action: https://github.com/anchore/sbom-action/actions/runs/9863167357/job/27235328478#step:6:246 |
https://github.com/anchore/scan-action/actions/runs/9864003440/job/27238006566#step:8:131 is another example of the |
Another one in sbom-action: https://github.com/anchore/sbom-action/actions/runs/9872881542/job/27263932911?pr=475#step:6:239 |
Both scan-action and sbom-action have their tests running in series now. We can re-open this if the issue returns. |
The unit tests for this repo sometimes fail with an error like this:
(link)
I believe this is because the tests run simultaneously, but
runGrype
is not threadsafe.scan-action/index.js
Lines 31 to 35 in 52d017b
This has a race condition, since whatever is present in the cache may be changed by one test while another test is checking it. I've also seen ENOENT in test runs.
The text was updated successfully, but these errors were encountered: