milestone 31: concurrent upstream exchanges, dot session reuse, queue metrics
Gates / frontend (push) Successful in 1m26s
Gates / test (push) Successful in 1m55s
Gates / test-aarch64 (push) Failing after 3h1m8s
Gates / package (push) Successful in 3m55s
Gates / container (push) Successful in 15s
CI / gates (push) Failing after 3h21m29s
Gates / frontend (push) Successful in 1m26s
Gates / test (push) Successful in 1m55s
Gates / test-aarch64 (push) Failing after 3h1m8s
Gates / package (push) Successful in 3m55s
Gates / container (push) Successful in 15s
CI / gates (push) Failing after 3h21m29s
This commit is contained in:
@@ -155,15 +155,32 @@ const FaultyUpstream = struct {
|
||||
}
|
||||
};
|
||||
|
||||
fn testEntry(url: []const u8, upstream_client: transport.Client, priority: i32) pool.Entry {
|
||||
return .{
|
||||
.endpoint = transport.Endpoint.parse(url) catch unreachable,
|
||||
.client = upstream_client,
|
||||
.priority = priority,
|
||||
.enabled = true,
|
||||
.health = .init,
|
||||
};
|
||||
}
|
||||
/// One-slot entry storage: the slot the entry points at and the recovery
|
||||
/// counter it borrows, declared by the test so both outlive the pool. These
|
||||
/// tests drive failover and deadlines, not concurrency within one upstream, so
|
||||
/// one slot per entry is the whole story here.
|
||||
const EntryStorage = struct {
|
||||
slots: [1]pool.Slot = undefined,
|
||||
recoveries: std.atomic.Value(u64) = .init(0),
|
||||
|
||||
fn entry(
|
||||
self: *EntryStorage,
|
||||
url: []const u8,
|
||||
upstream_client: transport.Client,
|
||||
priority: i32,
|
||||
) pool.Entry {
|
||||
self.slots[0] = .{ .client = upstream_client };
|
||||
return .{
|
||||
.endpoint = transport.Endpoint.parse(url) catch unreachable,
|
||||
.slots = &self.slots,
|
||||
.priority = priority,
|
||||
.enabled = true,
|
||||
.health = .init,
|
||||
.sem = .{ .permits = self.slots.len },
|
||||
.reuse_recoveries = &self.recoveries,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const Outcome = union(enum) {
|
||||
work: anyerror!void,
|
||||
@@ -250,9 +267,11 @@ test "the whole resolver answers over udp and tcp and fails over to a healthy up
|
||||
.fail_first = std.math.maxInt(u64),
|
||||
};
|
||||
var good: GoodUpstream = .{};
|
||||
var bad_storage: EntryStorage = .{};
|
||||
var good_storage: EntryStorage = .{};
|
||||
var entries = [_]pool.Entry{
|
||||
testEntry("https://bad.example/dns-query", bad.client(), 10),
|
||||
testEntry("tls://good.example", good.client(), 20),
|
||||
bad_storage.entry("https://bad.example/dns-query", bad.client(), 10),
|
||||
good_storage.entry("tls://good.example", good.client(), 20),
|
||||
};
|
||||
var upstreams: pool.Pool = .init(&entries, test_cfg, pool_timeouts, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user