Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Tune tests to support MS Windows #341

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Conversation

pan3793
Copy link
Collaborator

@pan3793 pan3793 commented Jul 16, 2024

Summary

This PR aims to tune the code to make the test runnable on Microsoft Windows.

Unfortunately, my MacBook got damaged and I have to use a Windows machine these days, when I try to run the test with .\gradlew.bat clean test, I get the following errors

xenon.clickhouse.HashSuite *** ABORTED *** (0 milliseconds)
  java.lang.RuntimeException: Unable to load a Suite class xenon.clickhouse.HashSuite that was discovered in the runpath: requirement failed: illegal path: D:\Projects\spark-clickhouse-connector\clickhouse-core-it\build\classes\scala\test      
  at org.scalatest.tools.DiscoverySuite$.getSuiteInstance(DiscoverySuite.scala:80)
  at org.scalatest.tools.DiscoverySuite.$anonfun$nestedSuites$1(DiscoverySuite.scala:38)
  at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:286)
  at scala.collection.Iterator.foreach(Iterator.scala:943)
  at scala.collection.Iterator.foreach$(Iterator.scala:943)
  at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
  at scala.collection.IterableLike.foreach(IterableLike.scala:74)
  at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
  at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
  at scala.collection.TraversableLike.map(TraversableLike.scala:286)

this is because Windows uses backslash as the path separator while UNIX-like OS uses the slash, it can be easily fixed by replacing path string match with Java NIO methods.

for developers who want to run tests on Windows, you need to:

  1. install JDK 8 or 11 or 17 - download and unarchive a JDK tarball, set env JAVA_HOME and add %JAVA_HOME%\bin to PATH
  2. install Hadoop winutils - just clone the repo and set HADOOP_HOME to the-path-of\hadoop-3.0.0
  3. install Docker Desktop

after applying patch, I can run tests successfully

 .\gradlew.bat clean test

...

Tests: succeeded 74, failed 0, canceled 0, ignored 0, pending 0
All tests passed.

BUILD SUCCESSFUL in 4m 18s
26 actionable tasks: 26 executed

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@pan3793 pan3793 requested review from mshustov and BentsiLeviav July 17, 2024 13:42
@pan3793
Copy link
Collaborator Author

pan3793 commented Jul 22, 2024

cc @wForget, can you do me a favor to test it on Windows if you have time? thanks

@wForget
Copy link

wForget commented Jul 22, 2024

cc @wForget, can you do me a favor to test it on Windows if you have time? thanks

Sure, , I will do it later.

Copy link

@wForget wForget left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, after applying this patch, .\gradlew.bat clean test executes successfully on Windows 11.

image

@pan3793 pan3793 merged commit b1e99cc into ClickHouse:main Aug 6, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants