When building v3.5.0 under WSL (Ubuntu 20.04), the following test fails:
./gradlew :spring-boot-project:spring-boot:test --tests "org.springframework.boot.context.properties.ConfigurationPropertiesTests.loadWhenBindingWithParentContextShouldBind"
The failure occurs in this call chain:
loadWhenBindingWithParentContextShouldBind
-> load(new Class<?>[] { BasicConfiguration.class, BasicPropertiesConsumer.class }, "name=child")
-> this.context.refresh()
-> obtainFreshBeanFactory()
-> refreshBeanFactory()
-> !this.refreshed.compareAndSet(false, true) == true
However, this test passes successfully in:
- Windows 11
- Ubuntu 22.04
Please help investigate why it fails specifically in WSL on Ubuntu 20.04.
Comment From: philwebb
What's the actual failure you're seeing? Can you provide any stack trace and log output.
Comment From: LinkDownZ
org.opentest4j.AssertionFailedError:
expected: "child"
but was: "orange"
at app//org.springframework.boot.context.properties.ConfigurationPropertiesTests.loadWhenBindingWithParentContextShouldBind(ConfigurationPropertiesTests.java:310)
at java.base@21.0.7/java.lang.reflect.Method.invoke(Method.java:580)
at java.base@21.0.7/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base@21.0.7/java.util.ArrayList.forEach(ArrayList.java:1596)
Comment From: wilkinsona
I can't see where orange would come from, particularly when running that one test in isolation. My best guess is that your WSL environment has an environment variable named NAME with the value orange that's affecting the test.
Comment From: vpavic
A few years ago I played with building Spring Boot under WSL and reported similar issues, see:
- https://github.com/spring-projects/spring-boot/issues/31076
- https://github.com/spring-projects/spring-boot/pull/31267
With environment variables like NAME it's somewhat likely to run into conflicts in some environments so I think it would be wise to avoid such generic names.
Comment From: LinkDownZ
The value of the NAME variable is indeed the same as the Windows hostname, and the compilation can temporarily succeed by using unset NAME.