Files
Charon/scripts/history-rewrite/tests/clean_history.non_interactive.bats
GitHub Actions 8294d6ee49 Add QA test outputs, build scripts, and Dockerfile validation
- Created `qa-test-output-after-fix.txt` and `qa-test-output.txt` to log results of certificate page authentication tests.
- Added `build.sh` for deterministic backend builds in CI, utilizing `go list` for efficiency.
- Introduced `codeql_scan.sh` for CodeQL database creation and analysis for Go and JavaScript/TypeScript.
- Implemented `dockerfile_check.sh` to validate Dockerfiles for base image and package manager mismatches.
- Added `sourcery_precommit_wrapper.sh` to facilitate Sourcery CLI usage in pre-commit hooks.
2025-12-11 18:26:24 +00:00

43 lines
1.3 KiB
Bash

#!/usr/bin/env bats
setup() {
TMPREPO=$(mktemp -d)
cd "$TMPREPO"
git init -q
# local git identity
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
echo "dummy" > backend/codeql-db/keep.txt
git add -A && git commit -m 'add test files' -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 non-interactive + force runs without prompting and invokes git-filter-repo" {
run bash "$SCRIPT" --force --non-interactive --paths 'backend/codeql-db' --strip-size 1
[ "$status" -eq 0 ]
[[ "$output" == *"stub git-filter-repo called"* ]]
}