nastra commented on code in PR #12194:
URL: https://github.com/apache/iceberg/pull/12194#discussion_r2262684910
##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -2698,6 +2706,133 @@ public void
testTableExistsFallbackToGETRequestWithLegacyServer() {
verifyTableExistsFallbackToGETRequest(ConfigResponse.builder().build());
}
+ @Test
+ public void testETagCreateTableAndLoadTable() {
+ Map<String, String> respHeaders = Maps.newConcurrentMap();
+
+ RESTCatalog catalog = setUpETagTest(respHeaders);
+
+ catalog.createTable(TABLE, SCHEMA);
+
+ assertThat(respHeaders).containsKey(HttpHeaders.ETAG);
+ String eTag = respHeaders.get(HttpHeaders.ETAG);
+ respHeaders.clear();
+
+ catalog.loadTable(TABLE);
+
+ assertThat(respHeaders).containsKey(HttpHeaders.ETAG);
+ assertThat(eTag).isEqualTo(respHeaders.get(HttpHeaders.ETAG));
+ respHeaders.clear();
+ }
+
+ @Test
+ public void testETagDifferentTables() {
+ Map<String, String> respHeaders = Maps.newConcurrentMap();
+
+ RESTCatalog catalog = setUpETagTest(respHeaders);
+
+ catalog.createTable(TABLE, SCHEMA);
+
+ assertThat(respHeaders).containsKey(HttpHeaders.ETAG);
+ String eTagTbl1 = respHeaders.get(HttpHeaders.ETAG);
+ respHeaders.clear();
+
+ catalog.createTable(TableIdentifier.of(TABLE.namespace(), "table2"),
SCHEMA);
+
+ assertThat(respHeaders).containsKey(HttpHeaders.ETAG);
+ assertThat(eTagTbl1).isNotEqualTo(respHeaders.get(HttpHeaders.ETAG));
+ }
+
+ @Test
+ public void testETagAfterDataUpdate() {
+ Map<String, String> respHeaders = Maps.newConcurrentMap();
+
+ RESTCatalog catalog = setUpETagTest(respHeaders);
+
+ catalog.createTable(TABLE, SCHEMA);
+
+ respHeaders.clear();
+
+ Table tbl = catalog.loadTable(TABLE);
Review Comment:
create table already returns the table, so no need to load it again here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]