ARTEMIS-6116 Fix tests for windows OS#6513
Conversation
| producer.applyProperties(mockMessage); | ||
|
|
||
| assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string.\n", context.getStderr()); | ||
| assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string.\n", context.getStderr().replace("\r\n", "\n")); |
There was a problem hiding this comment.
This seems like a good place to use System.lineSeparator().
There was a problem hiding this comment.
Changed to assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string." + System.lineSeparator()
cd991dc to
bf5d341
Compare
|
As far as I can tell, the two JDK8/IBM related commits aren't specific to Windows so they shouldn't be associated with ARTEMIS-6116 either. |
| // Normalize paths to forward slashes | ||
| String sourceKeyPath = sourceKey.replace("\\", "/"); | ||
| String sourceCertPath = sourceCert.replace("\\", "/"); | ||
|
|
||
| Files.write(serverPemConfigFile.toPath(), Arrays.asList(new String[]{ | ||
| "source.key=" + sourceKey, | ||
| "source.cert=" + sourceCert | ||
| "source.key=" + sourceKeyPath, | ||
| "source.cert=" + sourceCertPath |
There was a problem hiding this comment.
Are you sure this is strictly necessary? My testing indicates that it isn't.
There was a problem hiding this comment.
Retested - In my case, reverting back to "sourceKey" and "sourceCert" without replacing "\\" results in the following error:
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.528 s -- in org.apache.activemq.cli.test.WebServerCLITest
[INFO] Running org.apache.activemq.cli.test.WebServerComponentTest
[ERROR] Tests run: 33, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 6.559 s <<< FAILURE! -- in org.apache.activemq.cli.test.WebServerComponentTest
[ERROR] org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSources -- Time elapsed: 0.014 s <<< ERROR!
ootAppDataLocalTempjunit-6633549398662602348serverserver-key.pem:Users
at org.apache.activemq.artemis.component.WebServerComponent.getStoreFile(WebServerComponent.java:377)
at org.apache.activemq.artemis.component.WebServerComponent.addStoreResourceScannerTask(WebServerComponent.java:439)
at org.apache.activemq.artemis.component.WebServerComponent.addStoreResourceScannerTask(WebServerComponent.java:459)
at org.apache.activemq.artemis.component.WebServerComponent.createServerConnector(WebServerComponent.java:342)
at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:203)
at org.apache.activemq.cli.test.WebServerComponentTest.startSimpleSecureServer(WebServerComponentTest.java:373)
at org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSources(WebServerComponentTest.java:677)
at org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSources(WebServerComponentTest.java:618)
[ERROR] org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSourcesWithSymbolicLinks -- Time elapsed: 0.016 s <<< ERROR!
ootAppDataLocalTempjunit-10694756726840033654storestore-key.pemC:Users
at org.apache.activemq.artemis.component.WebServerComponent.getStoreFile(WebServerComponent.java:377)
at org.apache.activemq.artemis.component.WebServerComponent.addStoreResourceScannerTask(WebServerComponent.java:439)
at org.apache.activemq.artemis.component.WebServerComponent.addStoreResourceScannerTask(WebServerComponent.java:459)
at org.apache.activemq.artemis.component.WebServerComponent.createServerConnector(WebServerComponent.java:342)
at org.apache.activemq.artemis.component.WebServerComponent.start(WebServerComponent.java:203)
at org.apache.activemq.cli.test.WebServerComponentTest.startSimpleSecureServer(WebServerComponentTest.java:373)
at org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSources(WebServerComponentTest.java:677)
at org.apache.activemq.cli.test.WebServerComponentTest.testSSLAutoReloadPemConfigSourcesWithSymbolicLinks(WebServerComponentTest.java:623)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
ootAppDataLocalTempjunit-6633549398662602348serverserver-key.pemes:618->testSSLAutoReloadPemConfigSources:677->startSimpleSecureServer:373 » IllegalArgument Store file does not exist: C:Users
ootAppDataLocalTempjunit-10694756726840033654storestore-key.pemcesWithSymbolicLinks:623->testSSLAutoReloadPemConfigSources:677->startSimpleSecureServer:373 » IllegalArgument Store file does not exist: C:Users
[INFO]
[ERROR] Tests run: 36, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[ERROR]
There was a problem hiding this comment.
OK. Could you do something like this instead:
Files.write(serverPemConfigFile.toPath(), Arrays.asList(new String[]{
"source.key=" + sourceKey.replace("\\", "/"),
"source.cert=" + sourceCert.replace("\\", "/")
}));There was a problem hiding this comment.
Of course, this looks cleaner. Changed.
You're right - moving these to a separate issue as well. |
34fe053 to
4660c46
Compare
|
@jbertram you mentioned you tested my changes as well - what Windows version are you using? I am getting different results on Windows10 and Windows11 it seems. |
|
I was testing on Windows 10, but I went back and tested again after you responded and it looks like the slashes are indeed a real problem. |
79538d1 to
7fb5cf0
Compare
|
@jbertram can you review this again and let me know if anything needs changing? I think I solved everything, tested on win10 and win11. Also, the last commit is solving an edge case. Error only happens when user does not have permissions to create symlinks. p.s. does it make sense to create a github job to run builds/tests on Windows? |
Reduce network timeout checked because windows reports lower timeouts
Fixes issues related to backslashes
|
Rebased on main. |
Fixes tests on windows.