andrew4699 commented on code in PR #458:
URL: https://github.com/apache/polaris/pull/458#discussion_r1849302135


##########
polaris-service/src/test/java/org/apache/polaris/service/PolarisApplicationIntegrationTest.java:
##########
@@ -742,4 +750,85 @@ public void testRefreshToken() throws IOException {
       assertThat(sessionSpy.credential()).isNotEqualTo(userToken);
     }
   }
+
+  @Test
+  public void testReportMetricsLogsRequest(TestInfo testInfo) throws 
IOException {
+    ch.qos.logback.classic.Logger logger =
+        (ch.qos.logback.classic.Logger) 
LoggerFactory.getLogger(IcebergCatalogAdapter.class);
+    ListAppender<ILoggingEvent> listAppender = new ListAppender<>();
+    listAppender.start();
+    logger.addAppender(listAppender);
+
+    String catalogName = testInfo.getTestMethod().get().getName() + "External";
+    createCatalog(
+        catalogName,
+        Catalog.TypeEnum.EXTERNAL,
+        PRINCIPAL_ROLE_NAME,
+        FileStorageConfigInfo.builder(StorageConfigInfo.StorageTypeEnum.FILE)
+            .setAllowedLocations(List.of("file://" + 
testDir.toFile().getAbsolutePath()))
+            .build(),
+        "file://" + testDir.toFile().getAbsolutePath());
+    try (RESTSessionCatalog sessionCatalog = newSessionCatalog(catalogName);
+        HadoopFileIO fileIo = new HadoopFileIO(new Configuration()); ) {
+      SessionCatalog.SessionContext sessionContext = 
SessionCatalog.SessionContext.createEmpty();
+      Namespace ns = Namespace.of("db1");
+      sessionCatalog.createNamespace(sessionContext, ns);
+      TableIdentifier tableIdentifier = TableIdentifier.of(ns, "the_table");
+      String location =
+          "file://"
+              + testDir.toFile().getAbsolutePath()
+              + "/"
+              + testInfo.getTestMethod().get().getName();
+      String metadataLocation = location + 
"/metadata/000001-494949494949494949.metadata.json";
+
+      TableMetadata tableMetadata =
+          TableMetadata.buildFromEmpty()
+              .setLocation(location)
+              .assignUUID()
+              .addPartitionSpec(PartitionSpec.unpartitioned())
+              .addSortOrder(SortOrder.unsorted())
+              .addSchema(
+                  new Schema(Types.NestedField.of(1, false, "col1", 
Types.StringType.get())), 1)
+              .build();
+      TableMetadataParser.write(tableMetadata, 
fileIo.newOutputFile(metadataLocation));
+
+      sessionCatalog.registerTable(sessionContext, tableIdentifier, 
metadataLocation);
+      Table table = sessionCatalog.loadTable(sessionContext, tableIdentifier);
+
+      int schemaId =
+          82193782; // Keep this unique enough that the number wouldn't show 
up in the logs by
+      // coincedence

Review Comment:
   Updated it to check a unique string instead which is slightly better.



-- 
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]

Reply via email to