ayushtkn commented on code in PR #5880:
URL: https://github.com/apache/hive/pull/5880#discussion_r2179245352


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestRemoteHiveMetastoreWithHttpJwt.java:
##########
@@ -160,88 +116,53 @@ private static void setupMockServer() throws Exception {
         "http://localhost:"; + MOCK_JWKS_SERVER_PORT + "/jwks");
   }
 
-  /*
-  Tests a valid JWT sent to metastore sever
-   */
   @Test
   public void testValidJWT() throws Exception {
     String validJwtToken = generateJWT(USER_1, jwtAuthorizedKeyFile.toPath(),
         TimeUnit.MINUTES.toMillis(5));
-    System.getenv().put("HMS_JWT", validJwtToken);
-    String dbName = ("valid_jwt_" + TEST_DB_NAME_PREFIX + "_" + 
UUID.randomUUID()).toLowerCase();
-    HiveMetaStoreClient client = new HiveMetaStoreClient(conf);
-    try {
-      Database createdDb = new Database();
-      createdDb.setName(dbName);
-      client.createDatabase(createdDb);
-      Database dbFromServer = client.getDatabase(dbName);
-      assertEquals(dbName, dbFromServer.getName());
-    } finally {
-      try {
+
+    SystemLambda.withEnvironmentVariable("HMS_JWT", validJwtToken).execute(() 
-> {

Review Comment:
   Thanx @abstractdog for the pointers, I have replaced it as you suggested :-) 



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to