update
This commit is contained in:
+58
-2
@@ -48,6 +48,7 @@ assert payload["clustered"] is True
|
||||
'
|
||||
|
||||
printf '0\n' >"${test_dir}/curl-count"
|
||||
curl_should_fail=0
|
||||
curl() {
|
||||
local count data_path='' previous='' argument=''
|
||||
count="$(cat "${test_dir}/curl-count")"
|
||||
@@ -59,11 +60,11 @@ curl() {
|
||||
fi
|
||||
previous="$argument"
|
||||
done
|
||||
if [[ -n "$data_path" ]]; then
|
||||
if [[ -n "$data_path" && "$data_path" != '-' ]]; then
|
||||
cp "$data_path" "${test_dir}/curl-body-${count}.json"
|
||||
fi
|
||||
cat >"${test_dir}/curl-config-${count}"
|
||||
return 0
|
||||
(( curl_should_fail == 0 ))
|
||||
}
|
||||
|
||||
TAPM_FLEET_REGISTERED=1
|
||||
@@ -89,4 +90,59 @@ if compgen -G "${TMPDIR:-/tmp}/tapm-fleet-event.*" >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '0\n' >"${test_dir}/curl-count"
|
||||
TAPM_FLEET_ENROLLED=0
|
||||
TAPM_FLEET_REGISTERED=0
|
||||
TAPM_FLEET_LAST_VERSION=''
|
||||
TAPM_FLEET_COLLECT_METADATA() {
|
||||
TAPM_FLEET_HOSTNAME='pve01'
|
||||
TAPM_FLEET_GIT_COMMIT='0123456789abcdef0123456789abcdef01234567'
|
||||
TAPM_FLEET_PVE_VERSION='pve-manager/9.2.4'
|
||||
TAPM_FLEET_OS_VERSION='Debian GNU/Linux 13 (trixie)'
|
||||
TAPM_FLEET_KERNEL_VERSION='6.14.11-5-pve'
|
||||
TAPM_FLEET_ARCHITECTURE='amd64'
|
||||
TAPM_FLEET_CLUSTERED=true
|
||||
}
|
||||
|
||||
TAPM_FLEET_START '2026.7.28-9'
|
||||
TAPM_FLEET_FINISH 0
|
||||
if [[ "$(cat "${test_dir}/curl-count")" != 2 ]]; then
|
||||
printf 'FAIL: initial run did not make exactly registration + completion calls\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
TAPM_FLEET_LOAD_IDENTITY
|
||||
if [[ "$TAPM_FLEET_ENROLLED" != 1 ||
|
||||
"$TAPM_FLEET_LAST_VERSION" != '2026.7.28-9' ]]; then
|
||||
printf 'FAIL: successful fleet enrollment was not persisted\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAPM_FLEET_REGISTERED=0
|
||||
TAPM_FLEET_START '2026.7.28-9'
|
||||
TAPM_FLEET_FINISH 0
|
||||
if [[ "$(cat "${test_dir}/curl-count")" != 3 ]]; then
|
||||
printf 'FAIL: normal run made more than one broker call\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl_should_fail=1
|
||||
TAPM_FLEET_REGISTERED=0
|
||||
TAPM_FLEET_START '2026.7.28-9'
|
||||
TAPM_FLEET_FINISH 0
|
||||
TAPM_FLEET_LOAD_IDENTITY
|
||||
if [[ "$TAPM_FLEET_ENROLLED" != 0 ]]; then
|
||||
printf 'FAIL: failed fleet event did not schedule next-run re-enrollment\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl_should_fail=0
|
||||
TAPM_FLEET_REGISTERED=0
|
||||
TAPM_FLEET_START '2026.7.28-9'
|
||||
TAPM_FLEET_FINISH 0
|
||||
TAPM_FLEET_LOAD_IDENTITY
|
||||
if [[ "$TAPM_FLEET_ENROLLED" != 1 ]]; then
|
||||
printf 'FAIL: fleet client did not recover enrollment after a failed event\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'PASS: fleet identity and event client\n'
|
||||
|
||||
@@ -5,6 +5,9 @@ TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${TEST_ROOT}/tests/testlib.sh"
|
||||
source "${TEST_ROOT}/inc/git-update.inc"
|
||||
|
||||
assert_success "automatic Git check cache is 24 hours" \
|
||||
grep -q '^UPDATE_CACHE_SECONDS=86400$' "${TEST_ROOT}/proxmenu-scripts.sh"
|
||||
|
||||
TEST_TEMP_DIR="$(mktemp -d /tmp/tapm-git-tests.XXXXXX)"
|
||||
TEST_REPOSITORY="${TEST_TEMP_DIR}/repository"
|
||||
|
||||
|
||||
@@ -60,4 +60,16 @@ test_default_storage_selection() {
|
||||
|
||||
assert_success "default storage menu selection" test_default_storage_selection
|
||||
|
||||
pveam() {
|
||||
[[ "${1:-}" == list && "${2:-}" == local ]] || return 1
|
||||
printf '%s\n' \
|
||||
'NAME VOLID FORMAT TYPE SIZE VMID' \
|
||||
'local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst 0 0 0 0 0' \
|
||||
'local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst 0 0 0 0 0'
|
||||
}
|
||||
assert_equal \
|
||||
'local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst' \
|
||||
"$(TAPM_ISO_NFS_LOCAL_TEMPLATE local)" \
|
||||
"newest local Debian template avoids catalog refresh"
|
||||
|
||||
finish_tests
|
||||
|
||||
@@ -15,6 +15,10 @@ 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_equal 2 "$(TAPM_PULSE_BACKOFF_NEXT 1 8)" "Pulse backoff doubles"
|
||||
assert_equal 8 "$(TAPM_PULSE_BACKOFF_NEXT 4 8)" "Pulse backoff reaches cap"
|
||||
assert_equal 8 "$(TAPM_PULSE_BACKOFF_NEXT 8 8)" "Pulse backoff remains capped"
|
||||
|
||||
test_bridge_selection_assignment() {
|
||||
local bridge=''
|
||||
|
||||
|
||||
@@ -31,4 +31,13 @@ assert_equal virtio-win-server-2008r2-0.1.172.iso \
|
||||
assert_failure "unsafe local label rejected" \
|
||||
TAPM_VIRTIO_LABELED_FILENAME virtio-win-0.1.285.iso '../latest'
|
||||
|
||||
assert_success "fresh VirtIO cache accepted" \
|
||||
TAPM_VIRTIO_CACHE_VALID 1000 1500 86400 virtio-win-0.1.285.iso
|
||||
assert_failure "expired VirtIO cache rejected" \
|
||||
TAPM_VIRTIO_CACHE_VALID 1000 87400 86400 virtio-win-0.1.285.iso
|
||||
assert_failure "future VirtIO cache rejected" \
|
||||
TAPM_VIRTIO_CACHE_VALID 2000 1000 86400 virtio-win-0.1.285.iso
|
||||
assert_failure "unsafe VirtIO cache filename rejected" \
|
||||
TAPM_VIRTIO_CACHE_VALID 1000 1500 86400 ../../installer
|
||||
|
||||
finish_tests
|
||||
|
||||
Reference in New Issue
Block a user