mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo * fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler * fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest * test: add sdk tests for multipart S3 copy coverage * fix: cover and fix smithy cbor and multipart s3 copy regressions * test: migrate more test coverage to new folder * test: add missing ec2 expectation in healthcheck test * docs: update READMEs in `./compatibility-tests`
This commit is contained in:
1 parent
9b2a987fec
commit
eeefb729c4
165 files changed
+29969
-15
No files matched your search
@@ -177,7 +177,8 @@ public class AwsJsonController {
|
||||
gen.writeEndArray();
|
||||
} else if ("Timestamp".equals(fieldName) && node.isNumber()) {
|
||||
gen.writeTag(1);
|
||||
gen.writeNumber(node.longValue());
|
||||
// Smithy rpc-v2-cbor timestamps are epoch seconds encoded as tagged floating-point numbers.
|
||||
gen.writeNumber(node.doubleValue());
|
||||
} else if (node.isTextual()) {
|
||||
gen.writeString(node.textValue());
|
||||
} else if (node.isDouble() || node.isFloat()) {
|
||||
|
||||
+9
@@ -206,6 +206,15 @@ public class CloudWatchMetricsJsonHandler {
|
||||
if (parsed != null) datum.setTimestamp(parsed.getEpochSecond());
|
||||
}
|
||||
datum.setDimensions(parseDimensionsJson(item.path("Dimensions")));
|
||||
|
||||
JsonNode statsValues = item.path("StatisticValues");
|
||||
if (!statsValues.isMissingNode()) {
|
||||
datum.setSampleCount(statsValues.path("SampleCount").asDouble(0));
|
||||
datum.setSum(statsValues.path("Sum").asDouble(0));
|
||||
datum.setMinimum(statsValues.path("Minimum").asDouble(0));
|
||||
datum.setMaximum(statsValues.path("Maximum").asDouble(0));
|
||||
}
|
||||
|
||||
datums.add(datum);
|
||||
}
|
||||
return datums;
|
||||
|
||||
@@ -1255,13 +1255,17 @@ public class S3Controller {
|
||||
|
||||
private Response handleCopyObject(String copySource, String destBucket, String destKey,
|
||||
String contentType, HttpHeaders httpHeaders) {
|
||||
// copySource format: /bucket/key or bucket/key, where key is URL-encoded
|
||||
String source = copySource.startsWith("/") ? copySource.substring(1) : copySource;
|
||||
int slashIndex = source.indexOf('/');
|
||||
|
||||
// URL decode the entire source first, then split
|
||||
String decodedSource = URLDecoder.decode(source, StandardCharsets.UTF_8);
|
||||
int slashIndex = decodedSource.indexOf('/');
|
||||
if (slashIndex < 0) {
|
||||
throw new AwsException("InvalidArgument", "Invalid copy source: " + copySource, 400);
|
||||
}
|
||||
String sourceBucket = source.substring(0, slashIndex);
|
||||
String sourceKey = URLDecoder.decode(source.substring(slashIndex + 1), StandardCharsets.UTF_8);
|
||||
String sourceBucket = decodedSource.substring(0, slashIndex);
|
||||
String sourceKey = decodedSource.substring(slashIndex + 1);
|
||||
|
||||
String copyContentEncoding = toPersistedContentEncoding(httpHeaders.getHeaderString("Content-Encoding"));
|
||||
S3Object copy = s3Service.copyObject(sourceBucket, sourceKey, destBucket, destKey,
|
||||
@@ -1282,13 +1286,17 @@ public class S3Controller {
|
||||
|
||||
private Response handleUploadPartCopy(String copySource, String destBucket, String destKey,
|
||||
String uploadId, int partNumber, HttpHeaders httpHeaders) {
|
||||
// copySource format: /bucket/key or bucket/key, where key is URL-encoded
|
||||
String source = copySource.startsWith("/") ? copySource.substring(1) : copySource;
|
||||
int slashIndex = source.indexOf('/');
|
||||
|
||||
// URL decode the entire source first, then split.
|
||||
String decodedSource = URLDecoder.decode(source, StandardCharsets.UTF_8);
|
||||
int slashIndex = decodedSource.indexOf('/');
|
||||
if (slashIndex < 0) {
|
||||
throw new AwsException("InvalidArgument", "Invalid copy source: " + copySource, 400);
|
||||
}
|
||||
String sourceBucket = source.substring(0, slashIndex);
|
||||
String sourceKey = source.substring(slashIndex + 1);
|
||||
String sourceBucket = decodedSource.substring(0, slashIndex);
|
||||
String sourceKey = decodedSource.substring(slashIndex + 1);
|
||||
String copySourceRange = httpHeaders.getHeaderString("x-amz-copy-source-range");
|
||||
String eTag = s3Service.uploadPartCopy(destBucket, destKey, uploadId, partNumber,
|
||||
sourceBucket, sourceKey, copySourceRange);
|
||||
|
||||
Reference in new issue
Block a user