rahil-c commented on code in PR #9782:
URL: https://github.com/apache/iceberg/pull/9782#discussion_r1567967380


##########
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:
   Thank you for catching this, now able to get past this issue



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

Reply via email to