Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/integration_tests.zig
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,47 @@ test "integration harness covers settings and config round-trips" {
}
}

test "integration harness covers settings and config route contracts" {
var server = try IntegrationServer.startWithSeed(std.testing.allocator, struct {
fn call(srv: *IntegrationServer) !void {
try seedManagedInstance(srv, "nullboiler", "demo");
}
}.call);
defer server.deinit();

{
const resp = try server.fetch(.{ .path = "/api/settings", .method = .POST });
defer resp.deinit(std.testing.allocator);
try std.testing.expectEqual(std.http.Status.method_not_allowed, resp.status);
try std.testing.expect(std.mem.indexOf(u8, resp.body, "method not allowed") != null);
}

{
const resp = try server.fetch(.{
.path = "/api/instances/nullboiler/demo/config",
.method = .PATCH,
.body = "{\"gateway\":{\"port\":43124},\"provider\":\"patched\"}",
});
defer resp.deinit(std.testing.allocator);
try std.testing.expectEqual(std.http.Status.ok, resp.status);
try std.testing.expect(std.mem.indexOf(u8, resp.body, "\"status\":\"saved\"") != null);
}

{
const resp = try server.fetch(.{ .path = "/api/instances/nullboiler/demo/config?path=gateway.port" });
defer resp.deinit(std.testing.allocator);
try std.testing.expectEqual(std.http.Status.ok, resp.status);
try std.testing.expect(std.mem.indexOf(u8, resp.body, "\"value\":43124") != null);
}

{
const resp = try server.fetch(.{ .path = "/api/instances/nullboiler/demo/config", .method = .DELETE });
defer resp.deinit(std.testing.allocator);
try std.testing.expectEqual(std.http.Status.method_not_allowed, resp.status);
try std.testing.expect(std.mem.indexOf(u8, resp.body, "method not allowed") != null);
}
}

test "integration harness covers orchestration proxy not configured" {
var server = try IntegrationServer.start(std.testing.allocator);
defer server.deinit();
Expand Down
Loading