Compare commits

..

No commits in common. "eafb62aee99eb2b048c7ba4865bd9fd8b6f5c2b4" and "827c90ab8aacaabdb4e2f64f9dd69b956abd0b5b" have entirely different histories.

2 changed files with 10 additions and 19 deletions

View File

@ -59,6 +59,8 @@ WebIdentityToken is not yet implemented.
TODO List:
* re-enable all demos. Some are causing compilation errors, and these errors
do not have reference tracing as they exist within monomorphised code
* Implement all demos as tests in src/aws.zig. This has been done for
STS GetCallerIdentity, but needs to be extended for the others
* Json parsing is based on a fork of the 0.9.0 (maybe earlier?) json parser.

View File

@ -1328,7 +1328,6 @@ const TestOptions = struct {
request_headers: *std.http.Headers = undefined,
test_server_runtime_uri: ?[]u8 = null,
server_ready: bool = false,
requests_processed: usize = 0,
const Self = @This();
@ -1346,7 +1345,7 @@ const TestOptions = struct {
}
fn deinit(self: Self) void {
if (self.requests_processed > 0) {
if (self.request_body.len > 0) {
self.allocator.free(self.request_body);
self.allocator.free(self.request_target);
self.request_headers.deinit();
@ -1408,11 +1407,8 @@ fn processRequest(options: *TestOptions, server: *std.http.Server) !void {
@memcpy(&errbuf, errstr);
var response_bytes: []const u8 = errbuf[0..];
options.requests_processed += 1;
if (res.request.content_length) |l|
options.request_body = try res.reader().readAllAlloc(options.allocator, @as(usize, l))
else
options.request_body = try options.allocator.dupe(u8, "");
options.request_body = try res.reader().readAllAlloc(options.allocator, @as(usize, l));
options.request_method = res.request.method;
options.request_target = try options.allocator.dupe(u8, res.request.target);
options.request_headers = try options.allocator.create(std.http.Headers);
@ -1718,6 +1714,8 @@ test "json_1_1_query_no_input: ecs listClusters runtime" {
try std.testing.expectEqualStrings("arn:aws:ecs:us-west-2:550620852718:cluster/web-applicationehjaf-cluster", call.response.cluster_arns.?[0]);
}
test "rest_json_1_query_with_input: lambda listFunctions runtime" {
// TODO: This passes but leaks like a sieve
if (true) return error.SkipZigTest;
const allocator = std.testing.allocator;
var test_harness = TestSetup.init(allocator, .{
.allocator = allocator,
@ -1746,12 +1744,10 @@ test "rest_json_1_query_with_input: lambda listFunctions runtime" {
// Response expectations
try std.testing.expectEqualStrings("c4025199-226f-4a16-bb1f-48618e9d2ea6", call.response_metadata.request_id);
try std.testing.expectEqual(@as(usize, 1), call.response.functions.?.len);
try std.testing.expectEqualStrings(
"DevelopmentFrontendStack--amplifyassetdeploymentha-aZqB9IbZLIKU",
call.response.functions.?[0].function_name.?,
);
try std.testing.expectEqualStrings("DevelopmentFrontendStack--amplifyassetdeploymentha-aZqB9IbZLIKU", call.response.functions.?[0].function_name.?);
}
test "rest_json_1_query_no_input: lambda listFunctions runtime" {
if (true) return error.SkipZigTest; // TODO: Figure out leaks
const allocator = std.testing.allocator;
var test_harness = TestSetup.init(allocator, .{
.allocator = allocator,
@ -1775,13 +1771,6 @@ test "rest_json_1_query_no_input: lambda listFunctions runtime" {
, test_harness.request_options.request_body);
// Response expectations
try std.testing.expectEqualStrings("b2aad11f-36fc-4d0d-ae92-fe0167fb0f40", call.response_metadata.request_id);
try std.testing.expectEqual(@as(usize, 24), call.response.functions.?.len);
try std.testing.expectEqualStrings(
"DevelopmentFrontendStack--amplifyassetdeploymentha-aZqB9IbZLIKU",
call.response.functions.?[0].function_name.?,
);
try std.testing.expectEqualStrings(
"amplify-login-create-auth-challenge-b4883e4c",
call.response.functions.?[12].function_name.?,
);
try std.testing.expectEqual(@as(usize, 1), call.response.functions.?.len);
try std.testing.expectEqualStrings("arn:aws:ecs:us-west-2:550620852718:cluster/web-applicationehjaf-cluster", call.response.functions.?[0].function_name.?);
}