Skip to content

fix: Fix another flaky test - #319

Merged
kalbasit merged 1 commit into
mainfrom
fix-flaky-test
Sep 24, 2025
Merged

kalbasit merged 1 commit into
mainfrom
fix-flaky-test

Conversation

@kalbasit

@kalbasit kalbasit commented Sep 24, 2025 •

Copy link
Copy Markdown
Owner

This test is flaky because it assumes the GetNar will return after it has downloaded from upstream (given the server is serving from in-memory) but in reality it can actually take two calls which means the last_accessed_at is no longer the same as created_at but is ahead by a second or so; I fixed it by first waiting for the NAR to be in the store which will guarantee the database is in way we expect it to be.

closes #317

@kalbasit kalbasit mentioned this pull request Sep 24, 2025
@aciceri

aciceri commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

I've executed go test ./... one hundred times and I got no failures.
Do you want to me to also try building it with nix?

@kalbasit

Copy link
Copy Markdown
Owner Author

I'll merge for now, let me know if you get failures as you're working on the nixos module. Thanks!

@kalbasit
kalbasit merged commit ea79afc into main Sep 24, 2025
@kalbasit
kalbasit deleted the fix-flaky-test branch September 24, 2025 20:20
@aciceri

aciceri commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Where can we discuss this? Here?

I've just tried building a derivation from a big project with many derivations cached in private cachix cache (which is now served through ncps) and it seems to have worked. I would like to share ncps logs here but I fear they may contain private stuff, if you want I can share them privately (are you on matrix by the way?).

The only messages I see are those:

Details
[1 copied (0.1 MiB), 33.5 MiB DL] querying x509-store-1.6.9-doc on http://myNcpsInstance.tld:8501direnv: ([/nix/store/4qdw7vf42v66daia1b5cmgmhbqdziash-direnv-2.37.1/bin/direnv export json]) is taking a while to execute. Use CTRL-C to give up.
warning: error: unable to download 'http://myNcpsInstance.tld:8501/y7ywcxkckgm9ngkb89gazb719p3w2x7m.narinfo': HTTP error 500

       response body:

       error performing the request: Head "https://<privateCache>.cachix.org/y7ywcxkckgm9ngkb89gazb719p3w2x7m.narinfo": http2: server sent GOAWAY and closed the connection; LastStreamID=673, ErrCode=PROTOCOL_ERROR, debug=""; retrying in 252 ms
warning: error: unable to download 'http://myNcpsInstance.tld:8501/1j5kys76f6bpdn350bpj36gajqcachwx.narinfo': HTTP error 500

       response body:

       error performing the request: Head "https://<publicCache>.cachix.org/1j5kys76f6bpdn350bpj36gajqcachwx.narinfo": http2: server sent GOAWAY and closed the connection; LastStreamID=525, ErrCode=PROTOCOL_ERROR, debug=""; retrying in 308 ms

warning: download buffer is full; consider increasing the 'download-buffer-size' setting

@kalbasit

Copy link
Copy Markdown
Owner Author

Where can we discuss this? Here?

I've just tried building a derivation from a big project with many derivations cached in private cachix cache (which is now served through ncps) and it seems to have worked. I would like to share ncps logs here but I fear they may contain private stuff, if you want I can share them privately (are you on matrix by the way?).

Yes, I'm @kalbasit:matrix.org on Matrix. I also just created ncps space for public discussions.

The only messages I see are those:

[1 copied (0.1 MiB), 33.5 MiB DL] querying x509-store-1.6.9-doc on http://myNcpsInstance.tld:8501direnv: ([/nix/store/4qdw7vf42v66daia1b5cmgmhbqdziash-direnv-2.37.1/bin/direnv export json]) is taking a while to execute. Use CTRL-C to give up.
warning: error: unable to download 'http://myNcpsInstance.tld:8501/y7ywcxkckgm9ngkb89gazb719p3w2x7m.narinfo': HTTP error 500

       response body:

       error performing the request: Head "https://<privateCache>.cachix.org/y7ywcxkckgm9ngkb89gazb719p3w2x7m.narinfo": http2: server sent GOAWAY and closed the connection; LastStreamID=673, ErrCode=PROTOCOL_ERROR, debug=""; retrying in 252 ms
warning: error: unable to download 'http://myNcpsInstance.tld:8501/1j5kys76f6bpdn350bpj36gajqcachwx.narinfo': HTTP error 500

       response body:

       error performing the request: Head "https://<publicCache>.cachix.org/1j5kys76f6bpdn350bpj36gajqcachwx.narinfo": http2: server sent GOAWAY and closed the connection; LastStreamID=525, ErrCode=PROTOCOL_ERROR, debug=""; retrying in 308 ms

warning: download buffer is full; consider increasing the 'download-buffer-size' setting

I see these sometimes as well on my instance (I pull from nix-community) I think they are harmless but I haven't spent time trying to fully assess that. There's also #298.

kalbasit added a commit that referenced this pull request Sep 24, 2025
* origin/main:
  chore: Update nixpkgs and Go dependencies (#320)
  fix: Fix another flaky test (#319)
  feat(auth): Add netrc support for upstream authentication (#310)
  fix(CI): Do not run the docker-manifest if push is disabled (#318)
  fix(pkg/cache): Increase the wait time around asynchronous logic (#315)
  fix(CI): Do not attempt to access secrets for PRs from forks (#316)
  feat(Docker): Add /storage as Volume in the Docker image (#313)
  fix(Docker): Create /tmp in the Docker image (#312)
  feat(run): Accept extra arguments to ncps serve (#311)
  fix(GitHub): The Docker build on aarch64-linux (#308)
  chore(deps): update determinatesystems/nix-installer-action action to v20 (#306)
  fix(deps): update module golang.org/x/term to v0.35.0 (#304)
  fix(deps): update module github.com/xsam/otelsql to v0.40.0 (#303)
  fix(deps): update module golang.org/x/sync to v0.17.0 (#302)
  fix(deps): update module github.com/prometheus/client_golang to v1.23.2 (#300)
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.

Some tests are flaky

2 participants