#!/bin/bash # CHECK script for json_config_validator.py # Verifies the artifact works correctly VALIDATOR="/root/.hermes/wizard-outputs/spark/json_config_validator.py" TEST_VALID="/root/.hermes/wizard-outputs/spark/test_config.json" TEST_INVALID="/root/.hermes/wizard-outputs/spark/sample_invalid.json" # Check 1: Validator file exists if [ ! -f "$VALIDATOR" ]; then echo "FAIL: Validator script not found" exit 1 fi # Check 2: Validate a good JSON file (should exit 0) python3 "$VALIDATOR" "$TEST_VALID" > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "FAIL: Valid JSON rejected" exit 1 fi # Check 3: Reject invalid JSON file (should exit 1) python3 "$VALIDATOR" "$TEST_INVALID" > /dev/null 2>&1 if [ $? -ne 1 ]; then echo "FAIL: Invalid JSON not rejected" exit 1 fi # Check 4: Missing file should exit 1 (returns INVALID: File not found) python3 "$VALIDATOR" "/nonexistent.json" > /dev/null 2>&1 if [ $? -ne 1 ]; then echo "FAIL: Missing file not handled correctly" exit 1 fi echo "All checks passed" exit 0