Skip to content

Add in-repo action integration tests#190

Open
robtaylor wants to merge 2 commits intoawalsh128:masterfrom
robtaylor:fix/test-workflows
Open

Add in-repo action integration tests#190
robtaylor wants to merge 2 commits intoawalsh128:masterfrom
robtaylor:fix/test-workflows

Conversation

@robtaylor
Copy link
Copy Markdown

Summary

  • Brings integration tests from the separate cache-apt-pkgs-action-ci repo into this repo
  • Tests use uses: ./ to test the local checkout directly
  • Eliminates the need for cross-repo dispatch events and PUBLISH_PUSH_TOKEN secrets
  • 29 test jobs covering core workflow, error handling, regressions, and special cases

Changes from external CI tests

  • uses: awalsh128/cache-apt-pkgs-action@masteruses: ./
  • Updated actions/checkout@v3.1.0actions/checkout@v4
  • Made version-list assertions resilient (grep for expected packages rather than exact string match, since dependency versions change with Ubuntu updates)
  • Improved error-case verification pattern
  • Triggers on push to master/dev/staging and on pull requests

Test plan

  • Verify all 29 test jobs pass on ubuntu-latest
  • Verify cache install/restore cycle works correctly
  • Verify error cases (empty packages, missing packages) fail as expected
  • Verify regression tests still catch their respective issues

Bring the integration tests from the separate cache-apt-pkgs-action-ci
repo into this repo. Tests now use `uses: ./` to test the local checkout
directly, eliminating the need for cross-repo dispatch events.

Tests cover:
- Core workflow: install, restore, cache invalidation, package ordering
- Error handling: empty packages, missing packages, invalid version
- Regression tests: issues awalsh128#36, awalsh128#37, awalsh128#72, awalsh128#76, awalsh128#79, awalsh128#81, awalsh128#84, awalsh128#89, awalsh128#98, awalsh128#106
- Special cases: multi-arch cache keys, virtual packages

Changes from the external CI tests:
- Uses `uses: ./` instead of `uses: awalsh128/cache-apt-pkgs-action@master`
- Updated checkout to actions/checkout@v4
- Made version-list assertions resilient (grep for expected packages
  rather than exact string match, since dependency versions change
  with Ubuntu updates)
- Improved error-case verification (check outcome != failure rather
  than only running on failure)
- Triggers on push to master/dev/staging and on pull requests

Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
After cache restore, dpkg had no record of the installed packages because:
1. Only preinst/postinst scripts were cached from /var/lib/dpkg/info/,
   missing .list, .md5sums, .conffiles, and other metadata files
2. The dpkg status database (/var/lib/dpkg/status) was never updated

This meant dpkg -s, apt list --installed, and anything checking package
state would not see the restored packages.

Fix:
- Cache all /var/lib/dpkg/info/<package>.* files (not just install scripts)
- Save each package's dpkg status entry to a .dpkg-status file
- On restore, append status entries to /var/lib/dpkg/status (skipping
  packages that are already registered)

Adds tests verifying dpkg -s reports packages as installed after both
fresh install and cache restore.

Co-developed-by: Claude Code v2.1.58 (claude-opus-4-6)
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.

1 participant