feat: add granular test commands to run.sh
Add test:unit, test:integration, and test:security commands to run.sh. Update test command to use test-runner.sh for better orchestration. Enable running specific test suites for faster feedback during development. 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
This commit is contained in:
48
run.sh
48
run.sh
@@ -20,14 +20,17 @@ mkdir -p "${OUTPUT_DIR}" "${BUILD_DIR}"
|
||||
usage() {
|
||||
echo "Usage: $0 [command]"
|
||||
echo "Commands:"
|
||||
echo " build Build Docker image"
|
||||
echo " test Run all tests"
|
||||
echo " test:iso Test ISO with libvirt VM (runs on host)"
|
||||
echo " lint Run linting checks"
|
||||
echo " clean Clean build artifacts"
|
||||
echo " shell Interactive shell in build container"
|
||||
echo " iso Build ISO (30-60 minutes)"
|
||||
echo " help Show this help message"
|
||||
echo " build Build Docker image"
|
||||
echo " test Run all tests"
|
||||
echo " test:unit Run unit tests only"
|
||||
echo " test:integration Run integration tests only"
|
||||
echo " test:security Run security tests only"
|
||||
echo " test:iso Test ISO with libvirt VM (runs on host)"
|
||||
echo " lint Run linting checks"
|
||||
echo " clean Clean build artifacts"
|
||||
echo " shell Interactive shell in build container"
|
||||
echo " iso Build ISO (30-60 minutes)"
|
||||
echo " help Show this help message"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -47,7 +50,34 @@ main() {
|
||||
-v "${BUILD_DIR}:/build" \
|
||||
-e BATS_TMPDIR=/build/tmp \
|
||||
"${DOCKER_IMAGE}" \
|
||||
bats -r /workspace/tests/
|
||||
bash -c "cd /workspace && ./test-runner.sh all"
|
||||
;;
|
||||
test:unit)
|
||||
echo "Running unit tests..."
|
||||
docker run --rm \
|
||||
-v "${SCRIPT_DIR}:/workspace:ro" \
|
||||
-v "${BUILD_DIR}:/build" \
|
||||
-e BATS_TMPDIR=/build/tmp \
|
||||
"${DOCKER_IMAGE}" \
|
||||
bash -c "cd /workspace && ./test-runner.sh unit"
|
||||
;;
|
||||
test:integration)
|
||||
echo "Running integration tests..."
|
||||
docker run --rm \
|
||||
-v "${SCRIPT_DIR}:/workspace:ro" \
|
||||
-v "${BUILD_DIR}:/build" \
|
||||
-e BATS_TMPDIR=/build/tmp \
|
||||
"${DOCKER_IMAGE}" \
|
||||
bash -c "cd /workspace && ./test-runner.sh integration"
|
||||
;;
|
||||
test:security)
|
||||
echo "Running security tests..."
|
||||
docker run --rm \
|
||||
-v "${SCRIPT_DIR}:/workspace:ro" \
|
||||
-v "${BUILD_DIR}:/build" \
|
||||
-e BATS_TMPDIR=/build/tmp \
|
||||
"${DOCKER_IMAGE}" \
|
||||
bash -c "cd /workspace && ./test-runner.sh security"
|
||||
;;
|
||||
lint)
|
||||
echo "Running linting checks..."
|
||||
|
||||
Reference in New Issue
Block a user