Skip to content

Add comprehensive tests for package caching mechanism (PR #557 / Issue #521)#712

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/add-unit-integration-test
Draft

Add comprehensive tests for package caching mechanism (PR #557 / Issue #521)#712
Copilot wants to merge 5 commits intomasterfrom
copilot/add-unit-integration-test

Conversation

Copy link
Contributor

Copilot AI commented Jan 18, 2026

Test Plan for Package Caching Validation (PR #557 / Issue #521)

Understanding the Issue ✅

  • Analyze existing caching mechanism in scylla_repository.py
  • Review get_url_hash() implementation for local files, S3, and HTTP
  • Understand the hash validation logic (lines 337-361 in scylla_repository.py)

Unit Tests Created ✅

  • Test get_url_hash() for local files (7 tests)
  • Test get_url_hash() for HTTP URLs (mocked)
  • Test get_url_hash() for S3 URLs (mocked)
  • Test save_source_file() and get_installed_scylla_package_hash() (4 tests)
  • Test hash comparison logic (2 tests)
  • Test edge cases (4 tests - corrupted files, special characters, md5sum failures)

Integration Tests Created ✅

  • Test local file hash caching (validates issue Improve caching of local tarballs #521 fix)
  • Test local file hash change detection
  • Test setup() with environment variable local package
  • All tests added to test_caching_hash.py and test_scylla_repository.py

Test Execution Results ✅

  • All 22 new tests passing (3 skipped as expected)
  • All 53 existing unit tests still passing
  • Tests cover local files, S3, and HTTP download scenarios
  • Documentation added (CACHING_TESTS_README.md)
  • Unused imports removed from test_caching_hash.py

Test Files Created

  • tests/test_caching_hash.py (new, 365 lines)

    • TestGetUrlHash (7 tests)
    • TestSourceFileOperations (4 tests)
    • TestCachingIntegration (2 tests)
    • TestScyllaSetupCaching (2 tests)
    • TestRealDownloadCaching (3 tests, skipped)
    • TestCachingEdgeCases (4 tests)
  • tests/test_scylla_repository.py (modified)

    • TestLocalFileCaching (3 integration tests)
  • tests/CACHING_TESTS_README.md (new)

    • Complete documentation of test coverage
    • Execution instructions
    • Troubleshooting guide

Validation Complete ✅

The tests comprehensively validate that PR #557 fixes issue #521 by:

  1. ✅ Testing hash calculation for local files via md5sum
  2. ✅ Testing hash storage in source.txt files
  3. ✅ Testing hash retrieval and comparison
  4. ✅ Testing cache invalidation on hash mismatch
  5. ✅ Testing all three download types (local, S3, HTTP)
Original prompt

create unit test an intgration test to validate #557 base on report from #521 (comment) that the caching isn't working as expected with local files (check also download from s3 and from http)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Tests validate the fix for PR #557 and issue #521 where caching wasn't working
correctly with local files. Includes:

- Unit tests for get_url_hash() with local files, S3, and HTTP URLs
- Unit tests for save_source_file() and get_installed_scylla_package_hash()
- Integration tests for hash-based cache validation
- Edge case tests for corrupted files and hash mismatches
- Tests for local file caching in scylla_repository.py

All tests pass successfully.

Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Added detailed README explaining test coverage, execution, and validation
of PR #557 and issue #521 fix.

Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Copilot AI changed the title [WIP] Create unit and integration test for caching validation Add comprehensive tests for package caching mechanism (PR #557 / Issue #521) Jan 18, 2026
Copilot AI requested a review from fruch January 18, 2026 07:21
@fruch
Copy link
Contributor

fruch commented Jan 18, 2026

@copilot

fix review comments about unused imports

Removed unused imports:
- tempfile (not used in file)
- time (not used in file)
- Mock (only MagicMock is used)
- requests (only used in @patch decorator as string)

All 22 tests still pass.

Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@copilot

fix review comments about unused imports

Fixed in commit 5805780. Removed unused imports from test_caching_hash.py:

  • tempfile (not used)
  • time (not used)
  • Mock (only MagicMock is used)
  • requests (only used in @patch decorator as string)

All 22 tests still pass.

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.

2 participants

Comments