I’m currently seeing an issue with my Java 8/Kotlin unit tests while executing them with Maven. This started happening after upgrading to MacOS Monterey. The tests run fine through IntelliJ.
One thing the tests have in common is, that they open ports/start a service.
In one instance, I’m trying to start a Redis test server on localhost and in a different one I’m opening a random port on localhost (via a wire mock rule).
Has anybody seen this issue before, it seems to solely affect Monterey - I assume I have to somehow grant Maven more permissions?!
Any help is appreciated.
Edit: Here some more info.
Error message (using redis.embedded.RedisServer):
[ERROR] Errors:
[ERROR] RedisCacheServiceTest » RedisConnection Unable to connect to Redis server: 127...
Code piece for this:
redisServer = RedisServer(REDIS_PORT)
redisServer.start()
val config = Config().apply {
useSingleServer().address = "redis://127.0.0.1:$REDIS_PORT"
}
redissonClient = Redisson.create(config)
and a failed assertion on the other (runs fine on other MacOS versions):
response.statusCode().is2xxSuccessful -> false
Code piece:
@Rule
@JvmField
var rule = WireMockRule(Options.DYNAMIC_PORT)
lateinit var uri: URI
Maven version: 3.8.3
Testing framework: jUnit5 (Jupiter)
Looks like this self-resolved by reinstalling Maven through
brew
. However, it also updated from 3.8.3 to 3.8.5 - so not entirely sure whether it was the upgrade or the reinstall. Regardless, it's fixed, yay!