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
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:
@@ -37,6 +37,7 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
|
|||||||
await using var toxiproxy = new ToxiproxyBuilder(
|
await using var toxiproxy = new ToxiproxyBuilder(
|
||||||
"ghcr.io/shopify/toxiproxy:2.12.0")
|
"ghcr.io/shopify/toxiproxy:2.12.0")
|
||||||
.WithNetwork(network)
|
.WithNetwork(network)
|
||||||
|
.WithNetworkAliases("toxiproxy")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
await network.CreateAsync();
|
await network.CreateAsync();
|
||||||
@@ -100,22 +101,6 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
|
|||||||
"toxiproxy-approval"));
|
"toxiproxy-approval"));
|
||||||
Assert.True(approved.Ok);
|
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.True(await service.ProcessNextAsync());
|
||||||
Assert.False(await service.ProcessNextAsync());
|
Assert.False(await service.ProcessNextAsync());
|
||||||
|
|
||||||
@@ -159,6 +144,7 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
|
|||||||
import re
|
import re
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
agents = {}
|
agents = {}
|
||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
@@ -205,8 +191,24 @@ public sealed class ToxiproxyAgentProvisioningIntegrationTests
|
|||||||
with lock:
|
with lock:
|
||||||
agents[agent_id] = created
|
agents[agent_id] = created
|
||||||
|
|
||||||
# The mutation is committed before the response. Toxiproxy
|
# Install the downstream fault only after the mutation is
|
||||||
# blocks downstream bytes, recreating an uncertain dispatch.
|
# 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)
|
time.sleep(0.1)
|
||||||
self.send_json(200, {
|
self.send_json(200, {
|
||||||
"ok": True,
|
"ok": True,
|
||||||
@@ -229,7 +231,6 @@ internal sealed class ToxiproxyHttpGatewayConnector(Uri endpoint)
|
|||||||
private int createCalls;
|
private int createCalls;
|
||||||
|
|
||||||
public int CreateCalls => Volatile.Read(ref createCalls);
|
public int CreateCalls => Volatile.Read(ref createCalls);
|
||||||
public Func<CancellationToken, Task>? BeforeCreateAsync { get; set; }
|
|
||||||
public GatewayConnectionState ConnectionState => GatewayConnectionState.Connected;
|
public GatewayConnectionState ConnectionState => GatewayConnectionState.Connected;
|
||||||
public string? GatewayVersion => "2026.7.1";
|
public string? GatewayVersion => "2026.7.1";
|
||||||
public string? RequiredVersion => "2026.7.1";
|
public string? RequiredVersion => "2026.7.1";
|
||||||
@@ -289,8 +290,6 @@ internal sealed class ToxiproxyHttpGatewayConnector(Uri endpoint)
|
|||||||
break;
|
break;
|
||||||
case "agents.create":
|
case "agents.create":
|
||||||
Interlocked.Increment(ref createCalls);
|
Interlocked.Increment(ref createCalls);
|
||||||
if (BeforeCreateAsync is not null)
|
|
||||||
await BeforeCreateAsync(timeoutSource.Token);
|
|
||||||
response = await client.PostAsJsonAsync(
|
response = await client.PostAsJsonAsync(
|
||||||
"/agents/create",
|
"/agents/create",
|
||||||
JsonSerializer.SerializeToNode(parameters),
|
JsonSerializer.SerializeToNode(parameters),
|
||||||
|
|||||||
Reference in New Issue
Block a user