apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.23k stars 3.58k forks source link

[Bug] InvalidPathException in unit test of pulsar on windows 11 #21868

Open kerler opened 10 months ago

kerler commented 10 months ago

Search before asking

Version

3.1.2

Minimal reproduce step

On windows 11 with java 17, in CMD window, in folder of pulsar source code, run 'mvnw.cmd test'.

What did you expect to see?

Expect build success.

What did you see instead?

INFO] Running org.apache.pulsar.common.policies.data.NonPersistentPartitionedTopicStatsTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.289 s - in org.apache.pulsar.common.policies.data.LocalPolicesTest
[INFO] Running org.apache.pulsar.common.policies.data.OffloadPoliciesTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.205 s - in org.apache.pulsar.common.policies.data.NamespaceOwnershipStatusTest
[INFO] Running org.apache.pulsar.common.policies.data.PartitionedTopicStatsTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.233 s - in org.apache.pulsar.common.policies.data.NonPersistentPartitionedTopicStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.PersistencePoliciesTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.198 s - in org.apache.pulsar.common.policies.data.PartitionedTopicStatsTest
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.321 s <<< FAILURE! - in org.apache.pulsar.common.policies.data.OffloadPoliciesTest
[ERROR] org.apache.pulsar.common.policies.data.OffloadPoliciesTest.testSupportExtraOffloadDrivers  Time elapsed: 0 s  <<< FAILURE!
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Projs_github/pulsar/pulsar-common/target/test-classes/
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at org.apache.pulsar.common.policies.data.OffloadPoliciesTest$TestClassLoader.getClass(OffloadPoliciesTest.java:413)
        at org.apache.pulsar.common.policies.data.OffloadPoliciesTest$TestClassLoader.loadClass(OffloadPoliciesTest.java:406)
        at org.apache.pulsar.common.policies.data.OffloadPoliciesTest.testSupportExtraOffloadDrivers(OffloadPoliciesTest.java:387)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
        at org.testng.internal.invokers.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:47)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:76)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

[INFO] Running org.apache.pulsar.common.policies.data.PersistentOfflineTopicStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.PersistentTopicStatsTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.191 s - in org.apache.pulsar.common.policies.data.PersistencePoliciesTest
[INFO] Running org.apache.pulsar.common.policies.data.PoliciesDataTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.242 s - in org.apache.pulsar.common.policies.data.PersistentOfflineTopicStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.PolicyHierarchyValueTest
[WARNING] Tests run: 5, Failures: 0, Errors: 0, Skipped: 5, Time elapsed: 0.367 s - in org.apache.pulsar.common.policies.data.PersistentTopicStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.PublisherStatsTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.524 s - in org.apache.pulsar.common.policies.data.PoliciesDataTest
[INFO] Running org.apache.pulsar.common.policies.data.ReplicatorStatsTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.457 s - in org.apache.pulsar.common.policies.data.PolicyHierarchyValueTest
[INFO] Running org.apache.pulsar.common.policies.data.ResourceQuotaTest
[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.444 s - in org.apache.pulsar.common.policies.data.PublisherStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.RetentionPolicesTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.435 s - in org.apache.pulsar.common.policies.data.ReplicatorStatsTest
[INFO] Running org.apache.pulsar.common.policies.data.stats.SubscriptionStatsImplTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.496 s - in org.apache.pulsar.common.policies.data.ResourceQuotaTest

......

WARNING] Tests run: 12, Failures: 0, Errors: 0, Skipped: 12, Time elapsed: 3.707 s - in org.apache.pulsar.common.util.ReflectionsTest
[INFO] Running org.apache.pulsar.common.util.RunnablesTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.215 s - in org.apache.pulsar.common.util.RelativeTimeUtilTest
[INFO] Running org.apache.pulsar.common.util.TrustManagerProxyTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 3.292 s - in org.apache.pulsar.common.util.RunnablesTest
[INFO] Running org.apache.pulsar.common.util.URIPreconditionsTest
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 4.274 s <<< FAILURE! - in org.apache.pulsar.common.util.TrustManagerProxyTest
[ERROR] org.apache.pulsar.common.util.TrustManagerProxyTest.testLoadCA[ca/multiple-ca.pem, 2](4)  Time elapsed: 0 s  <<< FAILURE!
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Projs_github/pulsar/pulsar-common/target/test-classes/ca/multiple-ca.pem
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at org.apache.pulsar.common.util.FileModifiedTimeUpdater.updateLastModifiedTime(FileModifiedTimeUpdater.java:48)
        at org.apache.pulsar.common.util.FileModifiedTimeUpdater.<init>(FileModifiedTimeUpdater.java:43)
        at org.apache.pulsar.common.util.TrustManagerProxy.<init>(TrustManagerProxy.java:48)
        at org.apache.pulsar.common.util.TrustManagerProxyTest.testLoadCA(TrustManagerProxyTest.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
        at org.testng.internal.invokers.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:47)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:76)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

[INFO] Running org.apache.pulsar.exception.PulsarExceptionTest
[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 3.43 s - in org.apache.pulsar.common.util.URIPreconditionsTest
[INFO] Running org.apache.pulsar.policies.data.loadbalancer.LocalBrokerDataTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 3.513 s - in org.apache.pulsar.exception.PulsarExceptionTest
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 16.486 s - in org.apache.pulsar.common.util.RateLimiterTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 3.276 s - in org.apache.pulsar.policies.data.loadbalancer.LocalBrokerDataTest

......

[INFO] Apache Pulsar :: Tests :: Pulsar-Client-Shade Test . SKIPPED
[INFO] Apache Pulsar :: Tests :: Pulsar-Client-Admin-Shade Test SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:08 min
[INFO] Finished at: 2024-01-09T09:13:36+08:00
[INFO] ------------------------------------------------------------------------
[INFO] 62 goals, 62 executed
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.0:test (default-test) on project pulsar-common: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Projs_github\pulsar\pulsar-common\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :pulsar-common

Anything else?

No.

Are you willing to submit a PR?

BewareMyPower commented 10 months ago

I've fixed a similar issue before: https://github.com/apache/pulsar/pull/18403. Maybe this issue can be fixed in a similar way?

Though BookKeeper does not handle Windows paths well, so the integration tests might not run well on Windows. It's better to switch to macOS or Linux for Pulsar development.