test(openclaw): inject timeout after create commit
CI - Build & Test / Backend (.NET) (push) Successful in 51s
CI - Build & Test / Backend integration (PostgreSQL/Toxiproxy) (push) Failing after 59s
CI - Build & Test / Frontend (Vue/TS) (push) Has been cancelled
CI - Build & Test / Security Check (push) Has been cancelled
CI - Build & Test / Deploy Nexus (push) Has been cancelled

This commit is contained in:
AzuTear
2026-08-01 01:49:26 +02:00
parent bf32a7def2
commit 5353db7862
@@ -37,6 +37,7 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
await using var toxiproxy = new ToxiproxyBuilder(
"ghcr.io/shopify/toxiproxy:2.12.0")
.WithNetwork(network)
.WithNetworkAliases("toxiproxy")
.Build();
await network.CreateAsync();
@@ -100,22 +101,6 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
"toxiproxy-approval"));
Assert.True(approved.Ok);
gateway.BeforeCreateAsync = async cancellationToken =>
{
using var toxicResponse = await toxiproxyAdmin.PostAsJsonAsync(
"/proxies/openclaw/toxics",
new
{
name = "delay-create-response",
type = "latency",
stream = "downstream",
toxicity = 1.0,
attributes = new { latency = 1500, jitter = 0 }
},
cancellationToken);
toxicResponse.EnsureSuccessStatusCode();
};
Assert.True(await service.ProcessNextAsync());
Assert.False(await service.ProcessNextAsync());
@@ -159,6 +144,7 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
import re
import threading
import time
import urllib.request
agents = {}
lock = threading.Lock()
@@ -205,8 +191,24 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
with lock:
agents[agent_id] = created
# The mutation is committed before the response. Toxiproxy
# blocks downstream bytes, recreating an uncertain dispatch.
# Install the downstream fault only after the mutation is
# committed. This distinguishes an uncertain response from a
# request that never crossed the dispatch boundary.
toxic = json.dumps({
"name": "delay-create-response",
"type": "latency",
"stream": "downstream",
"toxicity": 1.0,
"attributes": {"latency": 1500, "jitter": 0}
}).encode("utf-8")
request = urllib.request.Request(
"http://toxiproxy:8474/proxies/openclaw/toxics",
data=toxic,
headers={"Content-Type": "application/json"},
method="POST")
with urllib.request.urlopen(request, timeout=2):
pass
time.sleep(0.1)
self.send_json(200, {
"ok": True,
@@ -229,7 +231,6 @@ internal sealed class ToxiproxyHttpGatewayConnector(Uri endpoint)
private int createCalls;
public int CreateCalls => Volatile.Read(ref createCalls);
public Func<CancellationToken, Task>? BeforeCreateAsync { get; set; }
public GatewayConnectionState ConnectionState => GatewayConnectionState.Connected;
public string? GatewayVersion => "2026.7.1";
public string? RequiredVersion => "2026.7.1";
@@ -289,8 +290,6 @@ internal sealed class ToxiproxyHttpGatewayConnector(Uri endpoint)
break;
case "agents.create":
Interlocked.Increment(ref createCalls);
if (BeforeCreateAsync is not null)
await BeforeCreateAsync(timeoutSource.Token);
response = await client.PostAsJsonAsync(
"/agents/create",
JsonSerializer.SerializeToNode(parameters),