Rebrand project as Forkop
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
set -eo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PODKOP_LIB="$ROOT_DIR/podkop/files/usr/lib"
|
||||
GENERATOR="$PODKOP_LIB/singbox/generator.uc"
|
||||
FAILOVER="$PODKOP_LIB/singbox/dns_failover.uc"
|
||||
FORKOP_LIB="$ROOT_DIR/forkop/files/usr/lib"
|
||||
GENERATOR="$FORKOP_LIB/singbox/generator.uc"
|
||||
FAILOVER="$FORKOP_LIB/singbox/dns_failover.uc"
|
||||
WORK_DIR="$(mktemp -d)"
|
||||
|
||||
cleanup() {
|
||||
@@ -21,9 +21,9 @@ generate() {
|
||||
local fixture="$1"
|
||||
local output="$2"
|
||||
local state="${3:-$WORK_DIR/missing-state.json}"
|
||||
PODKOP_LIB="$PODKOP_LIB" \
|
||||
PODKOP_DNS_FAILOVER_STATE_FILE="$state" \
|
||||
ucode -L "$PODKOP_LIB" "$GENERATOR" generate-config-fixture "$fixture" "$output" 192.168.1.1 0
|
||||
FORKOP_LIB="$FORKOP_LIB" \
|
||||
FORKOP_DNS_FAILOVER_STATE_FILE="$state" \
|
||||
ucode -L "$FORKOP_LIB" "$GENERATOR" generate-config-fixture "$fixture" "$output" 192.168.1.1 0
|
||||
}
|
||||
|
||||
cat >"$WORK_DIR/single.json" <<'JSON'
|
||||
@@ -141,11 +141,11 @@ cat >"$WORK_DIR/alive-recovery.json" <<'JSON'
|
||||
{ "0": true, "1": true }
|
||||
JSON
|
||||
|
||||
selected="$(ucode -L "$PODKOP_LIB" "$FAILOVER" select-fixture "$WORK_DIR/select-state.json" "$WORK_DIR/alive-failover.json" main 0)"
|
||||
selected="$(ucode -L "$FORKOP_LIB" "$FAILOVER" select-fixture "$WORK_DIR/select-state.json" "$WORK_DIR/alive-failover.json" main 0)"
|
||||
printf '%s' "$selected" | grep -Eq '"index"[[:space:]]*:[[:space:]]*1' || fail "dead active DNS must select the first live server below"
|
||||
printf '%s' "$selected" | grep -Eq '"reason"[[:space:]]*:[[:space:]]*"active_dead"' || fail "failover reason"
|
||||
|
||||
selected="$(ucode -L "$PODKOP_LIB" "$FAILOVER" select-fixture "$WORK_DIR/select-state.json" "$WORK_DIR/alive-recovery.json" bootstrap 1)"
|
||||
selected="$(ucode -L "$FORKOP_LIB" "$FAILOVER" select-fixture "$WORK_DIR/select-state.json" "$WORK_DIR/alive-recovery.json" bootstrap 1)"
|
||||
printf '%s' "$selected" | grep -Eq '"index"[[:space:]]*:[[:space:]]*0' || fail "recovery must return to the highest live priority"
|
||||
printf '%s' "$selected" | grep -Eq '"reason"[[:space:]]*:[[:space:]]*"recovery"' || fail "recovery reason"
|
||||
|
||||
@@ -156,7 +156,7 @@ cat >"$WORK_DIR/verify-bootstrap.json" <<'JSON'
|
||||
{ "main_index": 0, "bootstrap_index": 1, "bootstrap_servers": [ "a", "b" ] }
|
||||
JSON
|
||||
|
||||
verification="$(ucode -L "$PODKOP_LIB" "$FAILOVER" verification-plan-fixture "$WORK_DIR/verify-previous.json" "$WORK_DIR/verify-bootstrap.json")"
|
||||
verification="$(ucode -L "$FORKOP_LIB" "$FAILOVER" verification-plan-fixture "$WORK_DIR/verify-previous.json" "$WORK_DIR/verify-bootstrap.json")"
|
||||
printf '%s' "$verification" | grep -Eq '"main"[[:space:]]*:[[:space:]]*false' || fail "bootstrap-only switch must not require a dead main DNS to recover"
|
||||
printf '%s' "$verification" | grep -Eq '"bootstrap"[[:space:]]*:[[:space:]]*true' || fail "bootstrap-only switch must verify the selected bootstrap DNS"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user