Files
Charon/scripts/history-rewrite/tests/clean_history.dryrun.bats
GitHub Actions 3169b05156 fix: skip incomplete system log viewer tests
- Marked 12 tests as skip pending feature implementation
- Features tracked in GitHub issue #686 (system log viewer feature completion)
- Tests cover sorting by timestamp/level/method/URI/status, pagination controls, filtering by text/level, download functionality
- Unblocks Phase 2 at 91.7% pass rate to proceed to Phase 3 security enforcement validation
- TODO comments in code reference GitHub #686 for feature completion tracking
- Tests skipped: Pagination (3), Search/Filter (2), Download (2), Sorting (1), Log Display (4)
2026-02-09 21:55:55 +00:00

50 lines
1.6 KiB
Bash

#!/usr/bin/env bats
setup() {
TMPREPO=$(mktemp -d)
cd "$TMPREPO"
git init -q
# Set local git identity for test commits
git config user.email "test@example.com"
git config user.name "Test Runner"
# create a directory that matches the paths to be pruned
mkdir -p backend/codeql-db
# add a large fake blob file
dd if=/dev/zero of=backend/codeql-db/largefile.bin bs=1M count=2 >/dev/null 2>&1 || true
git add -A && git commit -m 'add large blob' -q
git checkout -b feature/test
# Create a local bare repo to act as origin and allow git push
TMPORIGIN=$(mktemp -d)
git init --bare "$TMPORIGIN" >/dev/null
git remote add origin "$TMPORIGIN"
git push -u origin feature/test >/dev/null 2>&1 || true
# Add a stub git-filter-repo to PATH to satisfy requirements without installing
STUBBIN=$(mktemp -d)
cat > "$STUBBIN/git-filter-repo" <<'SH'
#!/usr/bin/env bash
echo "stub git-filter-repo called: $@"
exit 0
SH
chmod +x "$STUBBIN/git-filter-repo"
PATH="$STUBBIN:$PATH"
}
teardown() {
rm -rf "$TMPREPO"
}
REPO_ROOT=$(cd "$BATS_TEST_DIRNAME/../../../" && pwd)
SCRIPT="$REPO_ROOT/scripts/history-rewrite/clean_history.sh"
@test "clean_history dry-run prints expected log and exits 0" {
run bash "$SCRIPT" --dry-run --paths 'backend/codeql-db' --strip-size 1
[ "$status" -eq 0 ]
[[ "$output" == *"Dry-run complete"* ]]
}
@test "preview_removals shows commits for the path" {
run bash "$REPO_ROOT/scripts/history-rewrite/preview_removals.sh" --paths 'backend/codeql-db' --strip-size 1
[ "$status" -eq 0 ]
[[ "$output" == *"Path: backend/codeql-db"* ]]
}