diff --git a/tests/entrypoint_test.sh b/tests/entrypoint_test.sh index e8cb987..bc38fca 100755 --- a/tests/entrypoint_test.sh +++ b/tests/entrypoint_test.sh @@ -4,7 +4,7 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -fail() { +die() { echo "FAIL: $1" >&2 exit 1 } @@ -42,7 +42,7 @@ assert_status() { local actual="$1" local expected="$2" - [[ "$actual" -eq "$expected" ]] || fail "expected status $expected, got $actual" + [[ "$actual" -eq "$expected" ]] || die "expected status $expected, got $actual" } test_missing_oauth() { @@ -56,7 +56,7 @@ test_missing_oauth() { set -e assert_status "$status" 1 - grep -q "OAUTH is required" "$tmpdir/stderr" || fail "missing OAUTH error" + grep -q "OAUTH is required" "$tmpdir/stderr" || die "missing OAUTH error" rm -rf "$tmpdir" } @@ -71,7 +71,7 @@ test_missing_model() { set -e assert_status "$status" 1 - grep -q "MODEL is required" "$tmpdir/stderr" || fail "missing MODEL error" + grep -q "MODEL is required" "$tmpdir/stderr" || die "missing MODEL error" rm -rf "$tmpdir" } @@ -86,7 +86,7 @@ test_invalid_base64() { set -e assert_status "$status" 1 - grep -q "valid base64" "$tmpdir/stderr" || fail "invalid base64 error" + grep -q "valid base64" "$tmpdir/stderr" || die "invalid base64 error" rm -rf "$tmpdir" } @@ -101,7 +101,7 @@ test_non_object_json() { set -e assert_status "$status" 1 - grep -q "JSON object" "$tmpdir/stderr" || fail "non-object JSON error" + grep -q "JSON object" "$tmpdir/stderr" || die "non-object JSON error" rm -rf "$tmpdir" } @@ -112,9 +112,9 @@ test_success_output() { run_entrypoint "$tmpdir" OAUTH="$(encoded_json '{}')" MODEL="gpt-test" PROMPT="hello" - grep -q "status=completed" "$tmpdir/github-output" || fail "completed status output" - grep -q "codex ok" "$tmpdir/github-output" || fail "codex output" - [[ ! -e "$tmpdir/codex-home/auth.json" ]] || fail "auth.json was not cleaned up" + grep -q "status=completed" "$tmpdir/github-output" || die "completed status output" + grep -q "codex ok" "$tmpdir/github-output" || die "codex output" + [[ ! -e "$tmpdir/codex-home/auth.json" ]] || die "auth.json was not cleaned up" rm -rf "$tmpdir" } @@ -129,9 +129,9 @@ test_failure_output() { set -e assert_status "$status" 7 - grep -q "status=failed" "$tmpdir/github-output" || fail "failed status output" - grep -q "codex failed" "$tmpdir/github-output" || fail "failed codex output" - [[ ! -e "$tmpdir/codex-home/auth.json" ]] || fail "auth.json was not cleaned up after failure" + grep -q "status=failed" "$tmpdir/github-output" || die "failed status output" + grep -q "codex failed" "$tmpdir/github-output" || die "failed codex output" + [[ ! -e "$tmpdir/codex-home/auth.json" ]] || die "auth.json was not cleaned up after failure" rm -rf "$tmpdir" }