Skip to content

test: add unit tests for drift_checker.py (issue #2834) #3428

@mrveiss

Description

@mrveiss

Summary

autobot-slm-backend/services/drift_checker.py was added in commit 0dba8915b (#2834) with no accompanying unit tests. The service contains non-trivial logic that warrants test coverage.

File: autobot-slm-backend/services/drift_checker.py

What needs testing

  • _file_checksum() — correct SHA-256 for a known file
  • _collect_checksums() — skips _SKIP_DIRS, only includes _INCLUDE_EXTENSIONS, returns correct relative paths
  • compute_drift() — correctly classifies files as modified, source_only, deployed_only; handles missing source/deployed dirs gracefully; returns correct total_compared count
  • build_drift_report() — correct schema shape and drift_detected flag
  • get_default_source_dir() / get_default_deployed_dir() — env var override respected; fallback to root when subdir missing

Test file location

autobot-slm-backend/services/drift_checker_test.py (co-located with source, per project convention)

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions