update
This commit is contained in:
@@ -15,6 +15,37 @@ assert_equal amd64 "$(TAPM_PULSE_ARCH x86_64)" "x86 architecture mapping"
|
||||
assert_equal arm64 "$(TAPM_PULSE_ARCH aarch64)" "ARM architecture mapping"
|
||||
assert_failure "unsupported Pulse architecture" TAPM_PULSE_ARCH riscv64
|
||||
|
||||
bootstrap_token='0123456789abcdef0123456789abcdef0123456789abcdef'
|
||||
bootstrap_output="║ Token: ${bootstrap_token} ║"
|
||||
assert_equal "$bootstrap_token" \
|
||||
"$(TAPM_PULSE_BOOTSTRAP_TOKEN_FROM_OUTPUT "$bootstrap_output")" \
|
||||
"Pulse bootstrap token parsed"
|
||||
assert_failure "malformed Pulse bootstrap output rejected" \
|
||||
TAPM_PULSE_BOOTSTRAP_TOKEN_FROM_OUTPUT 'Token: not-a-token'
|
||||
|
||||
agent_token='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
|
||||
assert_equal "$agent_token" \
|
||||
"$(TAPM_PULSE_TOKEN_FROM_RESPONSE "{\"token\":\"${agent_token}\"}")" \
|
||||
"Pulse agent token parsed"
|
||||
assert_failure "missing Pulse agent token rejected" \
|
||||
TAPM_PULSE_TOKEN_FROM_RESPONSE '{"command":"install"}'
|
||||
assert_failure "Pulse agent token containing whitespace rejected" \
|
||||
TAPM_PULSE_TOKEN_FROM_RESPONSE '{"token":"invalid token"}'
|
||||
assert_failure "non-hex Pulse agent token rejected" \
|
||||
TAPM_PULSE_TOKEN_FROM_RESPONSE '{"token":"not-a-token"}'
|
||||
|
||||
nodes_json='[
|
||||
{"node":"pve3","status":"offline"},
|
||||
{"node":"pve2","status":"online"},
|
||||
{"node":"pve1","status":"online"}
|
||||
]'
|
||||
assert_equal $'pve1\npve2' \
|
||||
"$(TAPM_PULSE_ONLINE_NODES_FROM_JSON "$nodes_json")" \
|
||||
"online Pulse nodes selected and sorted"
|
||||
assert_equal 'pve3' \
|
||||
"$(TAPM_PULSE_OFFLINE_NODES_FROM_JSON "$nodes_json")" \
|
||||
"offline Pulse nodes reported"
|
||||
|
||||
assert_success "valid Pulse CTID" TAPM_PULSE_VALID_CTID 210
|
||||
assert_failure "invalid Pulse CTID" TAPM_PULSE_VALID_CTID 99
|
||||
assert_success "valid Pulse hostname" TAPM_PULSE_VALID_HOSTNAME pulse-monitor
|
||||
|
||||
Reference in New Issue
Block a user