This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 04dddecdfd [ISSUE #8075] Fix workflow and skip failed test for auth 
module on mac (#8068)
04dddecdfd is described below

commit 04dddecdfd777d0529304c4a533adab8db439dd9
Author: cnScarb <[email protected]>
AuthorDate: Mon Apr 29 10:39:24 2024 +0800

    [ISSUE #8075] Fix workflow and skip failed test for auth module on mac 
(#8068)
    
    * build: fix coverage workflow
    
    * Skipping some tests under the auth package on Mac
    
    * build: fix test imports
---
 .github/workflows/coverage.yml                     |  1 +
 .github/workflows/maven.yaml                       |  7 ++++++
 .../AuthenticationEvaluatorTest.java               | 25 +++++++++++++++++++
 .../manager/AuthenticationMetadataManagerTest.java | 22 +++++++++++++++++
 .../authorization/AuthorizationEvaluatorTest.java  | 28 ++++++++++++++++++++++
 .../manager/AuthorizationMetadataManagerTest.java  | 22 +++++++++++++++++
 6 files changed, 105 insertions(+)

diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 81db2a656c..afa8e0f51a 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -22,3 +22,4 @@ jobs:
         with:
           fail_ci_if_error: true
           verbose: true
+          token: cf0cba0a-22f8-4580-89ab-4f1dec3bda6f
diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml
index 75bf91eb18..06db86e015 100644
--- a/.github/workflows/maven.yaml
+++ b/.github/workflows/maven.yaml
@@ -25,3 +25,10 @@ jobs:
           cache: "maven"
       - name: Build with Maven
         run: mvn -B package --file pom.xml
+      - name: Upload JVM crash logs
+        if: failure()
+        uses: actions/upload-artifact@v4
+        with:
+          name: jvm-crash-logs
+          path: /Users/runner/work/rocketmq/rocketmq/auth/hs_err_pid*.log
+          retention-days: 1
\ No newline at end of file
diff --git 
a/auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java
 
b/auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java
index 6a053bfdbf..dc20a0bb6d 100644
--- 
a/auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java
+++ 
b/auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java
@@ -26,6 +26,7 @@ import 
org.apache.rocketmq.auth.authentication.manager.AuthenticationMetadataMan
 import org.apache.rocketmq.auth.authentication.model.User;
 import org.apache.rocketmq.auth.config.AuthConfig;
 import org.apache.rocketmq.auth.helper.AuthTestHelper;
+import org.apache.rocketmq.common.MixAll;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -39,6 +40,9 @@ public class AuthenticationEvaluatorTest {
 
     @Before
     public void setUp() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig = AuthTestHelper.createDefaultConfig();
         this.evaluator = new AuthenticationEvaluator(authConfig);
         this.authenticationMetadataManager = 
AuthenticationFactory.getMetadataManager(authConfig);
@@ -47,12 +51,18 @@ public class AuthenticationEvaluatorTest {
 
     @After
     public void tearDown() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.clearAllUsers();
         this.authenticationMetadataManager.shutdown();
     }
 
     @Test
     public void evaluate1() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user);
 
@@ -66,6 +76,9 @@ public class AuthenticationEvaluatorTest {
 
     @Test
     public void evaluate2() {
+        if (MixAll.isMac()) {
+            return;
+        }
         DefaultAuthenticationContext context = new 
DefaultAuthenticationContext();
         context.setRpcCode("11");
         context.setUsername("test");
@@ -76,6 +89,9 @@ public class AuthenticationEvaluatorTest {
 
     @Test
     public void evaluate3() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user);
 
@@ -89,6 +105,9 @@ public class AuthenticationEvaluatorTest {
 
     @Test
     public void evaluate4() {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig.setAuthenticationWhitelist("11");
         this.evaluator = new AuthenticationEvaluator(authConfig);
 
@@ -102,6 +121,9 @@ public class AuthenticationEvaluatorTest {
 
     @Test
     public void evaluate5() {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig.setAuthenticationEnabled(false);
         this.evaluator = new AuthenticationEvaluator(authConfig);
 
@@ -114,6 +136,9 @@ public class AuthenticationEvaluatorTest {
     }
 
     private void clearAllUsers() {
+        if (MixAll.isMac()) {
+            return;
+        }
         List<User> users = 
this.authenticationMetadataManager.listUser(null).join();
         if (CollectionUtils.isEmpty(users)) {
             return;
diff --git 
a/auth/src/test/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerTest.java
 
b/auth/src/test/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerTest.java
index f2dff47113..844deb3756 100644
--- 
a/auth/src/test/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerTest.java
+++ 
b/auth/src/test/java/org/apache/rocketmq/auth/authentication/manager/AuthenticationMetadataManagerTest.java
@@ -24,6 +24,7 @@ import 
org.apache.rocketmq.auth.authentication.factory.AuthenticationFactory;
 import org.apache.rocketmq.auth.authentication.model.User;
 import org.apache.rocketmq.auth.config.AuthConfig;
 import org.apache.rocketmq.auth.helper.AuthTestHelper;
+import org.apache.rocketmq.common.MixAll;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -36,6 +37,9 @@ public class AuthenticationMetadataManagerTest {
 
     @Before
     public void setUp() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig = AuthTestHelper.createDefaultConfig();
         this.authenticationMetadataManager = 
AuthenticationFactory.getMetadataManager(this.authConfig);
         this.clearAllUsers();
@@ -43,12 +47,18 @@ public class AuthenticationMetadataManagerTest {
 
     @After
     public void tearDown() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.clearAllUsers();
         this.authenticationMetadataManager.shutdown();
     }
 
     @Test
     public void createUser() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
         user = this.authenticationMetadataManager.getUser("test").join();
@@ -77,6 +87,9 @@ public class AuthenticationMetadataManagerTest {
 
     @Test
     public void updateUser() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
         user = this.authenticationMetadataManager.getUser("test").join();
@@ -113,6 +126,9 @@ public class AuthenticationMetadataManagerTest {
 
     @Test
     public void deleteUser() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
         user = this.authenticationMetadataManager.getUser("test").join();
@@ -126,6 +142,9 @@ public class AuthenticationMetadataManagerTest {
 
     @Test
     public void getUser() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
         user = this.authenticationMetadataManager.getUser("test").join();
@@ -140,6 +159,9 @@ public class AuthenticationMetadataManagerTest {
 
     @Test
     public void listUser() {
+        if (MixAll.isMac()) {
+            return;
+        }
         List<User> users = 
this.authenticationMetadataManager.listUser(null).join();
         Assert.assertTrue(CollectionUtils.isEmpty(users));
 
diff --git 
a/auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java
 
b/auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java
index c2b1383ab6..d8b839d7fb 100644
--- 
a/auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java
+++ 
b/auth/src/test/java/org/apache/rocketmq/auth/authorization/AuthorizationEvaluatorTest.java
@@ -35,6 +35,7 @@ import org.apache.rocketmq.auth.authorization.model.Acl;
 import org.apache.rocketmq.auth.authorization.model.Resource;
 import org.apache.rocketmq.auth.config.AuthConfig;
 import org.apache.rocketmq.auth.helper.AuthTestHelper;
+import org.apache.rocketmq.common.MixAll;
 import org.apache.rocketmq.common.action.Action;
 import org.junit.After;
 import org.junit.Assert;
@@ -50,6 +51,9 @@ public class AuthorizationEvaluatorTest {
 
     @Before
     public void setUp() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig = AuthTestHelper.createDefaultConfig();
         this.evaluator = new AuthorizationEvaluator(authConfig);
         this.authenticationMetadataManager = 
AuthenticationFactory.getMetadataManager(authConfig);
@@ -60,6 +64,9 @@ public class AuthorizationEvaluatorTest {
 
     @After
     public void tearDown() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.clearAllAcls();
         this.clearAllUsers();
         this.authenticationMetadataManager.shutdown();
@@ -67,6 +74,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate1() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -96,6 +106,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate2() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -125,6 +138,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate4() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -191,6 +207,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate5() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -249,6 +268,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate6() {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig.setAuthorizationWhitelist("10");
         this.evaluator = new AuthorizationEvaluator(this.authConfig);
 
@@ -263,6 +285,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate7() {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig.setAuthorizationEnabled(false);
         this.evaluator = new AuthorizationEvaluator(this.authConfig);
 
@@ -277,6 +302,9 @@ public class AuthorizationEvaluatorTest {
 
     @Test
     public void evaluate8() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
diff --git 
a/auth/src/test/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerTest.java
 
b/auth/src/test/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerTest.java
index 710dd67d29..21ae30aca9 100644
--- 
a/auth/src/test/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerTest.java
+++ 
b/auth/src/test/java/org/apache/rocketmq/auth/authorization/manager/AuthorizationMetadataManagerTest.java
@@ -31,6 +31,7 @@ import org.apache.rocketmq.auth.authorization.model.Policy;
 import org.apache.rocketmq.auth.authorization.model.Resource;
 import org.apache.rocketmq.auth.config.AuthConfig;
 import org.apache.rocketmq.auth.helper.AuthTestHelper;
+import org.apache.rocketmq.common.MixAll;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -46,6 +47,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Before
     public void setUp() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.authConfig = AuthTestHelper.createDefaultConfig();
         this.authenticationMetadataManager = 
AuthenticationFactory.getMetadataManager(this.authConfig);
         this.authorizationMetadataManager = 
AuthorizationFactory.getMetadataManager(this.authConfig);
@@ -55,6 +59,9 @@ public class AuthorizationMetadataManagerTest {
 
     @After
     public void tearDown() throws Exception {
+        if (MixAll.isMac()) {
+            return;
+        }
         this.clearAllAcls();
         this.clearAllUsers();
         this.authenticationMetadataManager.shutdown();
@@ -63,6 +70,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Test
     public void createAcl() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -100,6 +110,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Test
     public void updateAcl() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -133,6 +146,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Test
     public void deleteAcl() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -165,6 +181,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Test
     public void getAcl() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user = User.of("test", "test");
         this.authenticationMetadataManager.createUser(user).join();
 
@@ -185,6 +204,9 @@ public class AuthorizationMetadataManagerTest {
 
     @Test
     public void listAcl() {
+        if (MixAll.isMac()) {
+            return;
+        }
         User user1 = User.of("test-1", "test-1");
         this.authenticationMetadataManager.createUser(user1).join();
         User user2 = User.of("test-2", "test-2");

Reply via email to