45 lines
2.2 KiB
Bash
45 lines
2.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -u -o pipefail
|
|
|
|
TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
source "${TEST_ROOT}/tests/testlib.sh"
|
|
source "${TEST_ROOT}/inc/deploy-pulse-lxc.sh"
|
|
|
|
assert_success "stable Pulse release" TAPM_PULSE_VALID_RELEASE v6.1.1
|
|
assert_success "prerelease Pulse release" TAPM_PULSE_VALID_RELEASE v6.2.0-rc.1
|
|
assert_failure "Pulse release requires v prefix" TAPM_PULSE_VALID_RELEASE 6.1.1
|
|
assert_failure "Pulse release rejects URL content" \
|
|
TAPM_PULSE_VALID_RELEASE 'v6.1.1/../../latest'
|
|
|
|
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
|
|
|
|
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
|
|
assert_failure "invalid Pulse hostname" TAPM_PULSE_VALID_HOSTNAME 'pulse monitor'
|
|
assert_success "valid positive integer" TAPM_PULSE_VALID_POSITIVE_INTEGER 1024
|
|
assert_failure "zero is not positive" TAPM_PULSE_VALID_POSITIVE_INTEGER 0
|
|
assert_success "valid Pulse port" TAPM_PULSE_VALID_PORT 7655
|
|
assert_failure "Pulse port too high" TAPM_PULSE_VALID_PORT 65536
|
|
assert_success "valid Pulse IPv4 CIDR" TAPM_PULSE_VALID_IPV4_CIDR 10.10.1.50/24
|
|
assert_failure "invalid Pulse IPv4 CIDR" TAPM_PULSE_VALID_IPV4_CIDR 10.10.1.500/24
|
|
|
|
resources='[
|
|
{"type":"lxc","name":"pulse-a","tags":"tapm;pulse"},
|
|
{"type":"qemu","name":"unrelated"}
|
|
]'
|
|
assert_success "tagged Pulse LXC detected" TAPM_PULSE_RESOURCE_INSTALLED "$resources"
|
|
assert_success "legacy Pulse hostname detected" \
|
|
TAPM_PULSE_RESOURCE_INSTALLED '[{"type":"lxc","name":"Pulse"}]'
|
|
assert_failure "unrelated resource not detected" \
|
|
TAPM_PULSE_RESOURCE_INSTALLED '[{"type":"qemu","name":"pulse"}]'
|
|
|
|
ha_status=$'quorum OK\nmaster pve1 (active, Sat Jul 25 12:00:00 2026)\nlrm pve1 (active, Sat Jul 25 12:00:00 2026)'
|
|
assert_success "active Proxmox HA detected" TAPM_PULSE_HA_STATUS_ENABLED "$ha_status"
|
|
assert_failure "inactive Proxmox HA rejected" \
|
|
TAPM_PULSE_HA_STATUS_ENABLED $'quorum OK\nmaster pve1 (idle)'
|
|
|
|
finish_tests
|