frpc: restart it the first time the admin lines are added (a reload can't work yet)
Found in the VM test: the new install's tunnels never opened, because frpc only reads admin_addr when it starts, so the first reload failed. That first time (and whenever a reload fails), frpc is restarted under systemd and the report says so; later changes reload as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,3 +103,27 @@ EOF
|
||||
frpc_add hope events 20010 20011
|
||||
grep -qx 'server_addr = x' "$FRPC_INI"
|
||||
}
|
||||
|
||||
@test "the first time (admin lines just added) frpc is restarted; afterwards it's reloaded" {
|
||||
cat > "$TMP/bin/systemctl" <<'STUB'
|
||||
#!/usr/bin/env bash
|
||||
echo "systemctl $*" >> "$(dirname "$0")/../calls"
|
||||
STUB
|
||||
chmod +x "$TMP/bin/systemctl"
|
||||
PATH="$TMP/bin:$PATH"
|
||||
FRPC_NEEDS_RESTART=0
|
||||
frpc_add hope events 20010 20011
|
||||
[ "$FRPC_NEEDS_RESTART" = 1 ]
|
||||
run frpc_reload
|
||||
[ "$status" -eq 0 ]
|
||||
grep -q "systemctl restart frpc" "$TMP/calls"
|
||||
[[ "$output" == *"restarting it once"* ]]
|
||||
# Admin lines now there: the next change reloads.
|
||||
: > "$TMP/calls"
|
||||
FRPC_NEEDS_RESTART=0
|
||||
frpc_add bridge events 20020 20021
|
||||
[ "$FRPC_NEEDS_RESTART" = 0 ]
|
||||
frpc_reload
|
||||
! grep -q "restart frpc" "$TMP/calls"
|
||||
grep -q reload "$TMP/frp/reloads"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user