PeterZh6 opened a new issue, #11166:
URL: https://github.com/apache/inlong/issues/11166

   ### What happened
   
   When running the `Mongodb2StarRocksTest` in the `sort-end-to-end-test-v1.15` 
module, the test failed due to a `NoClassDefFoundError` exception caused by a 
missing `org.mongodb.bson` module. This exception occurred when `mongodb-cdc` 
attempted to connect to MongoDB, but the required BSON dependency was not 
available in the classpath. The issue appears to be due to a missing or 
misconfigured dependency for the MongoDB driver in the test environment.
   
   Attached are the screenshots of the problem and the logs.
   <img width="1280" alt="MongoDBError1" 
src="https://github.com/user-attachments/assets/ddfe6a58-783f-41ae-9863-f0d80a13ae47";>
   <img width="1280" alt="MongoDBError2" 
src="https://github.com/user-attachments/assets/53554e3e-9147-4b8e-b3e2-5875a3bf1a06";>
   
   ```log
   [INFO] -------------------------------------------------------
   [INFO]  T E S T S
   [INFO] -------------------------------------------------------
   [INFO] Running org.apache.inlong.sort.tests.Mongodb2StarRocksTest
   ERROR StatusLogger Reconfiguration failed: No configuration found for 
'7f31245a' at 'null' in 'null'
   11:15:26.905 [main] ERROR org.apache.inlong.sort.tests.Mongodb2StarRocksTest 
-
   
--------------------------------------------------------------------------------
   Test 
testMongodbUpdateAndDelete(org.apache.inlong.sort.tests.Mongodb2StarRocksTest) 
failed with:
   java.lang.AssertionError: expected:<[2,tom,Big 2-wheel scooter ]> but 
was:<[]>
           at org.junit.Assert.fail(Assert.java:89)
           at org.junit.Assert.failNotEquals(Assert.java:835)
           at org.junit.Assert.assertEquals(Assert.java:120)
           at org.junit.Assert.assertEquals(Assert.java:146)
           at 
org.apache.inlong.sort.tests.utils.JdbcProxy.checkResult(JdbcProxy.java:80)
           at 
org.apache.inlong.sort.tests.utils.JdbcProxy.checkResultWithTimeout(JdbcProxy.java:99)
           at 
org.apache.inlong.sort.tests.Mongodb2StarRocksTest.testMongodbUpdateAndDelete(Mongodb2StarRocksTest.java:147)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
           at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
           at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
           at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
           at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
           at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
           at 
org.apache.flink.util.TestNameProvider$1.evaluate(TestNameProvider.java:45)
           at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
           at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
           at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
           at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
           at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
           at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
           at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
           at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
           at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
           at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
           at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
           at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
           at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
           at 
org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30)
           at 
org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30)
           at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
           at org.junit.rules.RunRules.evaluate(RunRules.java:20)
           at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
           at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
           at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
           at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
           at 
org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
           at 
org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
           at 
org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
           at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
           at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
           at 
org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
           at 
org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
           at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
           at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
           at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
           at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
   
   
================================================================================
   [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 
135.708 s <<< FAILURE! - in org.apache.inlong.sort.tests.Mongodb2StarRocksTest
   [ERROR] 
org.apache.inlong.sort.tests.Mongodb2StarRocksTest.testMongodbUpdateAndDelete  
Time elapsed: 109.679 s  <<< FAILURE!
   java.lang.AssertionError: expected:<[2,tom,Big 2-wheel scooter ]> but 
was:<[]>
           at org.junit.Assert.fail(Assert.java:89)
           at org.junit.Assert.failNotEquals(Assert.java:835)
           at org.junit.Assert.assertEquals(Assert.java:120)
           at org.junit.Assert.assertEquals(Assert.java:146)
           at 
org.apache.inlong.sort.tests.utils.JdbcProxy.checkResult(JdbcProxy.java:80)
           at 
org.apache.inlong.sort.tests.utils.JdbcProxy.checkResultWithTimeout(JdbcProxy.java:99)
           at 
org.apache.inlong.sort.tests.Mongodb2StarRocksTest.testMongodbUpdateAndDelete(Mongodb2StarRocksTest.java:147)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
           at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
           at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
           at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
           at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
           at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
           at 
org.apache.flink.util.TestNameProvider$1.evaluate(TestNameProvider.java:45)
           at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
           at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
           at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
           at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
           at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
           at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
           at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
           at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
           at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
           at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
           at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
           at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
           at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
           at 
org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30)
           at 
org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30)
           at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
           at org.junit.rules.RunRules.evaluate(RunRules.java:20)
           at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
           at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
           at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
           at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
           at 
org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
           at 
org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
           at 
org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
           at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
           at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
           at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
           at 
org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
           at 
org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
           at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
           at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
           at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
           at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
           at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
   
   [INFO]
   [INFO] Results:
   [INFO]
   [ERROR] Failures:
   [ERROR]   Mongodb2StarRocksTest.testMongodbUpdateAndDelete:147 
expected:<[2,tom,Big 2-wheel scooter ]> but was:<[]>
   [INFO]
   [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
   [INFO]
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] 
------------------------------------------------------------------------
   ```
   
   
   ### What you expected to happen
   
   The Mongodb2StarRocksTest should have passed without throwing any exceptions 
because the MongoDB driver had been properly added to the mongodb-cdc 
dependency. The test was expected to run successfully, verifying MongoDB data 
sync operations with StarRocks.
   
   Attached is the screenshot of a successful test result.
   
![image](https://github.com/user-attachments/assets/8f3618f9-6880-4df0-aa2e-7ff079afe12a)
   
   ### How to reproduce
   
   To reproduce the issue:
   
   1. Pull the latest InLong code from GitHub.
   2. Run the `Mongodb2StarRocksTest` in the `sort-end-to-end-test-v1.15` 
module.
   3. To observe the full stack trace of the exception, you may need to modify 
the test to prevent the containers from being torn down immediately after 
failure. This can be achieved by adding an infinite loop (`while(true){}`) at 
the end of the test to keep the containers alive, allowing inspection of the 
exception details.
   
   **Test Modification:**
   
   In the `Mongodb2StarRocksTest`, modify the `testMongodbUpdateAndDelete` 
method as shown below to prevent the test from ending prematurely:
   More specifically, change `testMongodbUpdateAndDelete` of 
`Mongodb2StarRocksTest` in this manner
   ```java
   @Test
   public void testMongodbUpdateAndDelete() throws Exception {
       submitSQLJob(sqlFile, jdbcJar, mongodbJar, mysqlJdbcJar);
       waitUntilJobRunning(Duration.ofSeconds(10));
   
       // generate input
       MongoClient mongoClient = 
MongoClients.create(MONGODB_CONTAINER.getConnectionString());
       MongoDatabase database = mongoClient.getDatabase("test");
       MongoCollection<Document> collection = 
database.getCollection("test_input1");
   
       Document document1 = new Document("_id", 1)
               .append("name", "jacket")
               .append("description", "water resistent white wind breaker");
       Document document2 = new Document("_id", 2)
               .append("name", "scooter")
               .append("description", "Big 2-wheel scooter ");
       List<Document> documents = new ArrayList<Document>();
       documents.add(document1);
       documents.add(document2);
       collection.insertMany(documents);
       collection.updateOne(eq("_id", 2), combine(set("name", "tom")));
       collection.deleteOne(eq("_id", 1));
   
       JdbcProxy proxy =
               new JdbcProxy(STAR_ROCKS.getJdbcUrl(), STAR_ROCKS.getUsername(),
                       STAR_ROCKS.getPassword(),
                       STAR_ROCKS.getDriverClassName());
       List<String> expectResult =
               Arrays.asList("2,tom,Big 2-wheel scooter ");
   
       // Commented out the result check to keep containers alive
       // proxy.checkResultWithTimeout(expectResult, "test_output1", 3, 60000L);
   
       // Infinite loop to prevent teardown
       while(true) {
       }
   }
   ```
   
   
   ### Environment
   
   WSL Ubuntu-22.04
   JDK 8
   Maven 3.8.8
   
   ### InLong version
   
   master
   
   ### InLong Component
   
   InLong Sort
   
   ### Are you willing to submit PR?
   
   - [X] Yes, I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: dev-unsubscr...@inlong.apache.org.apache.org

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

Reply via email to