Skip to content

Add comprehensive test coverage and reporting infrastructure #12

@dandye

Description

@dandye

Summary

Currently LogStory has minimal test coverage with only basic validation tests. To mature the project, we need comprehensive testing infrastructure with coverage reporting and different types of tests.

Current Testing Gaps

  • Limited coverage: Only 2 test files (test_yaml.py, test_logstory.py)
  • No unit tests: Core functions in main.py and logstory.py lack unit tests
  • No integration tests: End-to-end scenarios aren't tested
  • No coverage reporting: Unknown how much code is actually tested
  • No mock infrastructure: Can't test without real GCP credentials

Proposed Improvements

Phase 1: Test Infrastructure

  • Add coverage.py and pytest to development dependencies
  • Create test coverage reporting in CI/CD pipeline
  • Set minimum coverage threshold (suggest 80%)
  • Add coverage badge to README

Phase 2: Unit Tests

  • Write unit tests for all functions in src/logstory/main.py
  • Write unit tests for all functions in src/logstory/logstory.py
  • Create mock infrastructure for GCP services (Storage, Secret Manager)
  • Test error handling and edge cases

Phase 3: Integration Tests

  • Create end-to-end test scenarios with sample data
  • Test full workflow from log ingestion to timestamp updates
  • Add tests for different log type configurations
  • Test CLI interface with various flag combinations

Phase 4: Advanced Testing

  • Add property-based testing for timestamp parsing using hypothesis
  • Create performance benchmarks for large log files
  • Add tests for concurrent processing scenarios

Benefits

  • Confidence in changes: Catch regressions before they reach production
  • Easier refactoring: Safe to improve code with comprehensive test coverage
  • Better documentation: Tests serve as executable documentation
  • Contributor onboarding: New contributors can understand expected behavior

Acceptance Criteria

  • Test coverage ≥80% for core functionality
  • All public functions have unit tests
  • CI fails if coverage drops below threshold
  • Tests can run without external dependencies (using mocks)
  • Test suite completes in <2 minutes

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions