Files
honey-biscuit-workshop/workshop-baker/tests/integration/run_tests.sh
T
Catty Steve 9174c4dd2a feat: rename to workshop-baker and implement stage-based prebake
workflow

- Rename crate/library/binary from workshop-executor to workshop-baker
- Remove unused modules (decorator, parser, schedule, variable) from lib
- Implement stage-based privilege dropping with prebake_drop_privilege()
- Add dry-run support in executor and CLI
- Add bootstrap.sh template script for user/workspace setup
- Add PrebakeStage::from_str() and Default impl
- Add get_drop_after() function for security config
- Fix version matching to handle "1.0" format variants
- Fix UPM all_managers() to return custom::Custom
- Add Python integration tests with Docker
- Simplify examples/prebake.yml to match template
2026-03-31 20:54:48 +08:00

88 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Run integration tests for workshop-baker
#
# Usage:
# ./run_tests.sh # Run all tests
# ./run_tests.sh --skip-docker # Skip Docker-based tests
# ./run_tests.sh --dry-run # Run dry-run prebake and save to dryrun.log
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
LOG_FILE="${PROJECT_ROOT}/dryrun.log"
# Parse arguments
SKIP_DOCKER=false
RUN_DRY_RUN=false
while [[ $# -gt 0 ]]; do
case $1 in
--skip-docker)
SKIP_DOCKER=true
shift
;;
--dry-run)
RUN_DRY_RUN=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
cd "$PROJECT_ROOT/workshop-baker"
# Function to run Python tests
run_python_tests() {
echo "=== Running Integration Tests ==="
if [ "$SKIP_DOCKER" = true ]; then
echo "Skipping Docker-based tests..."
python3 -m pytest tests/integration/test_prebake.py::TestPrebakeConfigValidation -v
python3 -m pytest tests/integration/test_prebake.py::TestPrebakeExamples -v
else
python3 -m pytest tests/integration/test_prebake.py -v
fi
}
# Function to run Rust tests
run_rust_tests() {
echo ""
echo "=== Running Rust Tests ==="
cargo test --lib
}
# Function to run prebake dry-run
run_prebake_dry_run() {
echo ""
echo "=== Running Prebake Dry-Run ==="
echo "Output will be saved to: $LOG_FILE"
cargo run -- \
--username test-user \
--pipeline test-pipeline \
--build-id test-build-001 \
--dry-run \
prebake examples/prebake.yml > "$LOG_FILE" 2>&1
echo "Dry-run completed. Results saved to: $LOG_FILE"
echo ""
echo "=== Last 30 lines of dryrun.log ==="
tail -30 "$LOG_FILE"
}
# Main execution
if [ "$RUN_DRY_RUN" = true ]; then
run_prebake_dry_run
else
run_python_tests
run_rust_tests
fi
echo ""
echo "=== All tests completed successfully ==="