mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(athena): serialize timestamps as epoch seconds in GetWorkGroup and GetTableMetadata responses (#1524)
This commit is contained in:
1 parent
a6c6cf6de9
commit
72146eeb02
4 files changed
+156
-12
No files matched your search
+33
-2
@@ -6,8 +6,7 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@QuarkusTest
|
||||
class AthenaGetWorkGroupIntegrationTest {
|
||||
@@ -74,6 +73,38 @@ class AthenaGetWorkGroupIntegrationTest {
|
||||
equalTo("Athena engine version 3"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reproduces issue #1498: the AthenaClient fails to unmarshal the {@code CreationTime} field returned by Floci's
|
||||
* {@code GetWorkGroup} response.
|
||||
*/
|
||||
@Test
|
||||
void getWorkGroupCreationTimeIsSerializedAsEpochSecondsNumber() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.CreateWorkGroup")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"Name": "timestamp-format-bug-wg"
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
var response = given()
|
||||
.header("X-Amz-Target", "AmazonAthena.GetWorkGroup")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"WorkGroup\": \"timestamp-format-bug-wg\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("WorkGroup.Name", equalTo("timestamp-format-bug-wg"))
|
||||
.body("WorkGroup.CreationTime", notNullValue())
|
||||
.body("WorkGroup.CreationTime", instanceOf(Number.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getWorkGroupNotFoundReturnsInvalidRequestException() {
|
||||
given()
|
||||
|
||||
+47
-5
@@ -2,11 +2,7 @@ package io.github.hectorvent.floci.services.athena;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
@@ -335,4 +331,50 @@ class AthenaIntegrationTest {
|
||||
.body("__type", equalTo("InvalidRequestException"))
|
||||
.body("message", equalTo("The primary workgroup cannot be deleted."));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(12)
|
||||
void getTableMetadataTimestampsAreSerializedAsEpochSecondsNumbers() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AWSGlue.CreateDatabase")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"DatabaseInput\": { \"Name\": \"ts-format-test\" } }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AWSGlue.CreateTable")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"DatabaseName": "ts-format-test",
|
||||
"TableInput": {
|
||||
"Name": "events",
|
||||
"TableType": "EXTERNAL_TABLE",
|
||||
"StorageDescriptor": {
|
||||
"Location": "s3://bucket/events",
|
||||
"Columns": [ { "Name": "id", "Type": "string" } ]
|
||||
}
|
||||
}
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.GetTableMetadata")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"CatalogName\": \"AwsDataCatalog\", \"DatabaseName\": \"ts-format-test\", \"TableName\": \"events\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("TableMetadata.Name", equalTo("events"))
|
||||
.body("TableMetadata.CreateTime", instanceOf(Number.class))
|
||||
.body("TableMetadata.LastAccessTime", instanceOf(Number.class));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user