-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconch-smoke.sh
More file actions
executable file
·51 lines (42 loc) · 1.45 KB
/
Copy pathconch-smoke.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# conch-smoke.sh - manual and deployment smoke tests for conch
set -euo pipefail
# Ensure conch binary is prioritized from current directory if present
CONCH="./conch"
if [ ! -f "$CONCH" ]; then
if ! command -v conch &>/dev/null; then
echo "ERROR: conch binary not found in current directory or PATH" >&2
exit 1
fi
CONCH="conch"
fi
echo "Using conch binary: $CONCH"
# Expecting vacant office to return exit code 1
echo "==> Testing vacant election office (expect exit code 1)"
if "$CONCH" elect "smoke-$$" --who &>/dev/null; then
echo "ERROR: expected vacant office to fail" >&2
exit 1
else
echo "PASS: vacant election returned non-zero exit code"
fi
# Acquire and run a simple command
echo "==> Testing election acquisition with clean command"
"$CONCH" elect "smoke-$$" -- true
echo "PASS: election acquisition succeeded"
# Inspect semaphore
echo "==> Testing semaphore who command"
"$CONCH" sema "smoke-$$" --max 2 --who || true
echo "PASS: semaphore who executed successfully"
# Add a cron job
echo "==> Testing cron job add"
"$CONCH" cron add "smoke-$$" --schedule '@every 1m' -- logger "conch smoke"
echo "PASS: cron job added successfully"
# List cron jobs
echo "==> Testing cron job list"
"$CONCH" cron ls --last
echo "PASS: cron job listed successfully"
# Remove cron job
echo "==> Testing cron job remove"
"$CONCH" cron rm "smoke-$$"
echo "PASS: cron job removed successfully"
echo "==> ALL SMOKE TESTS PASSED"