Commit Graph

3 Commits

Author SHA1 Message Date
Nick Bozhenko fcb9bd7bd6 Add comprehensive test coverage across all packages
- Add unit tests for API endpoints (db, error, files, gpg, graph, metrics, publish, repos, snapshot, storage, task)
- Add command-line interface tests for all cmd subcommands
- Add database tests including race condition tests for etcddb and goleveldb
- Add package management tests (collections, contents, graph, import, index files, dependencies)
- Add infrastructure tests (pgp, systemd activation, task management)
- Add utility tests (checksum, config accessor, logging, sanitize)
- Add race condition tests for concurrent operations

Test coverage improves reliability and helps catch regressions early.
2025-07-16 14:19:04 -04:00
Nick Bozhenko 1693863499 Fix S3 concurrent map writes causing pod crashes
PROBLEM:
- Pod crashes with "fatal error: concurrent map writes" during S3 publications
- Root cause: pathCache map in PublishedStorage accessed without synchronization
- Occurs during concurrent LinkFromPool operations in S3 publishing

SOLUTION:
- Add sync.RWMutex to PublishedStorage struct for thread-safe map access
- Implement double-check locking pattern for cache initialization
- Protect all map operations (read/write/delete) with appropriate locks

CHANGES:
- s3/public.go: Add pathCacheMutex field and protect all map operations
  * Cache initialization with double-check locking in LinkFromPool
  * Read operations protected with RLock/RUnlock
  * Write operations protected with Lock/Unlock
  * Delete operations in Remove() and RemoveDirs() protected

IMPACT:
- Eliminates concurrent map writes panic
- Prevents pod crashes during S3 publications
- Maintains performance with minimal synchronization overhead
- Uses read-write locks allowing concurrent reads while serializing writes
2025-07-15 22:46:37 -04:00
Nick Bozhenko 40ba104838 Add comprehensive CI/CD improvements and test coverage
This commit introduces major enhancements to the CI/CD pipeline and testing infrastructure:

CI/CD Improvements:
- Consolidated modern and legacy CI workflows into a single comprehensive pipeline
- Removed all publishing functionality from CI (no longer needed)
- Added 8 new advanced testing jobs for pull requests:
  * advanced-coverage: Detailed coverage analysis with base branch comparison
  * performance-profile: CPU and memory profiling with benchmarks
  * fuzz-test: Automated fuzz testing for supported packages
  * deep-analysis: Multiple static analysis tools (shadow, ineffassign, gosec, staticcheck)
  * mutation-test: Tests effectiveness of test suite on changed files
  * dependency-audit: Security vulnerabilities and outdated dependency checks
  * stress-test: Race detection with 100 iterations and parallel testing
  * test-report-summary: Aggregates all reports into a single PR comment
- Enabled RUN_LONG_TESTS by default for thorough testing
- Added automatic PR comment generation with all test results

Testing Infrastructure:
- Added comprehensive test files across all packages to improve coverage
- Implemented unit tests for previously untested packages
- Added race condition tests for concurrent operations
- Created integration tests for API endpoints
- Added storage backend tests (etcd, goleveldb)
- Implemented command-line interface tests

Local Testing Support:
- Added act configuration for testing GitHub Actions locally
- Created docker-compose.ci.yml for full CI environment simulation
- Updated CONTRIBUTING.md with detailed local testing instructions

Documentation Updates:
- Added comprehensive CI documentation to CONTRIBUTING.md
- Removed obsolete references to Travis CI
- Updated Go version requirements to 1.24
- Added act usage instructions and examples

Other Improvements:
- Updated .gitignore to exclude coverage reports and build artifacts
- Added test-act.yml workflow for testing act functionality
- Created CI_SUMMARY.md documenting all CI capabilities

These changes transform aptly's CI from a basic testing pipeline into a comprehensive quality assurance system that provides immediate feedback on code quality, performance, security, and test effectiveness.
2025-07-10 12:00:54 -04:00