fix: proxy-ctl test fix

This commit is contained in:
FUFSoB committed 2026-09-29 19:47:51 +05:00
1 parent fa0015d829
commit f609334849
2 files changed
+14 -3

No files matched your search

+4 -2
View File
@@ -168,7 +168,9 @@ pkgs.testers.runNixOSTest {
with subtest("runtime users and listeners"): with subtest("runtime users and listeners"):
cfg = "/run/proxy-suite-inbounds/config.json" cfg = "/run/proxy-suite-inbounds/config.json"
server.succeed("proxy-ctl inbounds users add friend --listener vless-in") server.succeed("proxy-ctl inbounds users add friend --listener vless-in")
server.succeed(f"jq -e '.inbounds[] | select(.tag == \"vless-in\") | .settings.clients | map(.email) == [\"tester\", \"friend\"]' {cfg}") # The reload's restart returns once the start script is forked: config.json is
# gone until it renders it again.
server.wait_until_succeeds(f"jq -e '.inbounds[] | select(.tag == \"vless-in\") | .settings.clients | map(.email) == [\"tester\", \"friend\"]' {cfg}")
server.succeed("proxy-ctl inbounds add rt vless --port 9001 --user friend --user tester") server.succeed("proxy-ctl inbounds add rt vless --port 9001 --user friend --user tester")
server.wait_for_open_port(9001) server.wait_for_open_port(9001)
server.succeed("proxy-ctl inbounds users | grep friend | grep -q rt") server.succeed("proxy-ctl inbounds users | grep friend | grep -q rt")
@@ -196,6 +198,6 @@ pkgs.testers.runNixOSTest {
server.succeed("journalctl -u proxy-suite-inbounds | grep -q \"ignoring runtime listener 'rt'\"") server.succeed("journalctl -u proxy-suite-inbounds | grep -q \"ignoring runtime listener 'rt'\"")
server.succeed("rm /var/lib/proxy-suite/inbounds.d/listeners/rt.json") server.succeed("rm /var/lib/proxy-suite/inbounds.d/listeners/rt.json")
server.succeed("proxy-ctl inbounds users rm friend") server.succeed("proxy-ctl inbounds users rm friend")
server.succeed(f"jq -e '.inbounds[] | select(.tag == \"vless-in\") | .settings.clients | map(.email) == [\"tester\"]' {cfg}") server.wait_until_succeeds(f"jq -e '.inbounds[] | select(.tag == \"vless-in\") | .settings.clients | map(.email) == [\"tester\"]' {cfg}")
''; '';
} }
+10 -1
View File
@@ -2499,7 +2499,13 @@ def _subscription_cache(tag):
def _runtime_entry_verify(kind, tag): def _runtime_entry_verify(kind, tag):
"""Only the backend parses the entry, so confirm it actually came up.""" """Only the backend parses the entry, so confirm it actually came up.
The reload's restart returns once the start script is forked, before it writes the
inventory again, so this gives it a moment.
"""
deadline = time.monotonic() + 15
while True:
if kind == "outbound": if kind == "outbound":
if tag in _outbound_tags(): if tag in _outbound_tags():
print(f"Added outbound: {tag}") print(f"Added outbound: {tag}")
@@ -2507,6 +2513,9 @@ def _runtime_entry_verify(kind, tag):
elif os.path.isfile(_subscription_cache(tag)): elif os.path.isfile(_subscription_cache(tag)):
print(f"Added subscription: {tag} ({_subscription_proxy_count_text(_subscription_cache(tag))} proxies)") print(f"Added subscription: {tag} ({_subscription_proxy_count_text(_subscription_cache(tag))} proxies)")
return return
if time.monotonic() >= deadline:
break
time.sleep(0.5)
sys.stdout.flush() sys.stdout.flush()
print(f"Saved {kind} '{tag}', but it did not come up. Check: proxy-ctl logs", file=sys.stderr) print(f"Saved {kind} '{tag}', but it did not come up. Check: proxy-ctl logs", file=sys.stderr)
print(f"Remove it again with: proxy-ctl proxy {_runtime_noun(kind)} rm {tag}", file=sys.stderr) print(f"Remove it again with: proxy-ctl proxy {_runtime_noun(kind)} rm {tag}", file=sys.stderr)