nastra commented on code in PR #9782:
URL: https://github.com/apache/iceberg/pull/9782#discussion_r1567071915


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -1796,6 +1799,48 @@ public void 
testCatalogExpiredBearerTokenIsRefreshedWithCredential(String oauth2
             any());
   }
 
+
+  @Test
+  public void testCatalogWithPagaintionTokenIssue() {
+    //TODO remove this test, Used to highlight issue with namespaces
+    String token =
+            
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE5OTk5OTk5OTk5fQ._3k92KJi2NTyTG6V1s2mzJ__GiQtL36DnzsZSkBdYPw";
+    Map<String, String> catalogHeaders = ImmutableMap.of("Authorization", 
"Bearer " + token);
+
+    RESTCatalogAdapter adapter = Mockito.spy(new 
RESTCatalogAdapter(backendCatalog));
+
+    String credential = "catalog:12345";
+    Map<String, String> contextCredentials =
+            ImmutableMap.of("token", token, "credential", credential);
+    SessionCatalog.SessionContext context =
+            new SessionCatalog.SessionContext(
+                    UUID.randomUUID().toString(), "user", contextCredentials, 
ImmutableMap.of());
+
+    RESTCatalog catalog = new RESTCatalog(context, (config) -> adapter);
+    catalog.initialize("prod", ImmutableMap.of(CatalogProperties.URI, 
"ignored", "token", token));
+
+    Mockito.verify(adapter)
+            .execute(
+                    eq(HTTPMethod.GET),
+                    eq("v1/config"),
+                    any(),
+                    any(),
+                    eq(ConfigResponse.class),
+                    eq(catalogHeaders),
+                    any());
+
+    Mockito.verify(adapter)

Review Comment:
   @rahil-c this fails because you're verifying that the namespaces endpoint 
has been called but you're actually not calling `catalog.listNamespaces(..)` in 
this test



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to