pdtpartners / nix-snapshotter

Brings native understanding of Nix packages to containerd
MIT License
532 stars 15 forks source link

Collect test coverage for both unit & NixOS integration tests #117

Closed elpdt852 closed 6 months ago

elpdt852 commented 6 months ago

Fix #43

As of go 1.20, we can compile go binaries with cover instrumentation to collect coverage for integration tests: https://go.dev/doc/build-cover

Combined with machine.copy_from_vm capability via a shared mount in the NixOS test framework, we can essentially collect Golang test coverage data even when nix-snapshotter is embedded in a systemd service, very cool!

We likely want to use codecov, which is free for open source (cc @gbpdt need approval for pdtpartners/nix-snapshotter). For now, I've added the coverage data to $GITHUB_STEP_SUMMARY.

elpdt852 commented 6 months ago

Previously it was generating a coverage report per integration test. Using actions/upload-artifact and actions/download-artifact I was able to copy each integration test coverage report into a single step to merge & produce the final coverage report.

elpdt852 commented 6 months ago

Thanks, looks like our current statement-level test coverage is 63.9%.