snapd icon indicating copy to clipboard operation
snapd copied to clipboard

c/snap-bootstrap: split test suite in separate files per mode

Open sespiros opened this issue 10 months ago • 6 comments

While working on adding integrity data, there were multiple test cases I had to consider and working with the huge monolithic test file of snap-bootstrap was very inconvenient. So in the same spirit of the cvm mode testsuite split, I would like to propose a per-mode split, so I am proposing separate files for:

  • classic : for hybrid related tests
  • factoryreset/install/run/recover : for tests related to these particular modes
  • installrun : tests that test the preseeding functionality

I have some other refactorings in mind as well so the split would be a good starting point.

sespiros avatar Jan 29 '25 20:01 sespiros

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.07%. Comparing base (a272aac) to head (31f1bc5). Report is 132 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #15002    +/-   ##
========================================
  Coverage   78.07%   78.07%            
========================================
  Files        1182     1184     +2     
  Lines      157743   158017   +274     
========================================
+ Hits       123154   123368   +214     
- Misses      26943    26985    +42     
- Partials     7646     7664    +18     
Flag Coverage Δ
unittests 78.07% <ø> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 29 '25 21:01 codecov[bot]

Wed Feb 26 13:30:37 UTC 2025 The following results are from: https://github.com/canonical/snapd/actions/runs/13524742257

No spread failures reported

github-actions[bot] avatar Jan 29 '25 21:01 github-actions[bot]

This has conflicts now

alfonsosanchezbeato avatar Feb 07 '25 21:02 alfonsosanchezbeato

@alfonsosanchezbeato I rebased on top of the latest master. Since there were several changes to cmd_initramfs_mounts_test.go (which this PR splits in multiple files), to deal with the complicated rebase I applied the changes which showed up by running:

git diff b8039669e8f3452fc5697d2dbe5082757546ebc0 ba9ef8ebe8960ccd8646e5508cae420bab304cf8 -- cmd/snap-bootstrap/cmd_initramfs_mounts_test.go

sespiros avatar Feb 10 '25 19:02 sespiros

I had to do this once more since it seems there were further changes in cmd_initramfs_mounts_test.go.

git diff ba9ef8ebe8960ccd8646e5508cae420bab304cf8 7e66af96655792f82705e9f40cfdd752854f085e -- cmd/snap-bootstrap/cmd_initramfs_mounts_test.go

sespiros avatar Feb 10 '25 20:02 sespiros

there might be more snap-bootstrap changes coming to master

pedronis avatar Feb 11 '25 10:02 pedronis

I rebased it once more.

git diff 7e66af96655792f82705e9f40cfdd752854f085e 2279c41419d64ad74ab1c6671ea115caefb71463 -- cmd/snap-bootstrap/cmd_initramfs_mounts_test.go

sespiros avatar Feb 25 '25 15:02 sespiros

Moved to milestone 2.69, this code splitting is not important to 2.68.2

ernestl avatar Feb 26 '25 09:02 ernestl