eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
712 stars 456 forks source link

SpringBootWatcherIntegrationTest fails on MacOS #3009

Closed arman-yekkehkhani closed 2 months ago

arman-yekkehkhani commented 2 months ago

Describe the bug

Test case withAllRequirementsShouldStartWatcherProcess from class SpringBootWatcherIntegrationTest is failing with a message indicating a mismatch between actual and wanted arguments to the process. Here is the complete message:

Argument(s) are different! Wanted:
runtime.exec(
    <custom argument matcher>
);
-> at java.base/java.lang.Runtime.exec(Runtime.java:453)
Actual invocations have different arguments:
runtime.exec(
    ["/Users/{my username}/.sdkman/candidates/java/17.0.5-amzn/bin/java", "-cp", "/private/var/folders/5q/fb9_qmc91h76mqsnyqxnf7x00000gn/T/junit14501484792843800327/target/spring-boot-lib.jar:/private/var/folders/5q/fb9_qmc91h76mqsnyqxnf7x00000gn/T/junit14501484792843800327/target/spring-boot-devtools.jar", "-Dspring.devtools.remote.secret=this-is-a-test", "org.springframework.boot.devtools.RemoteSpringApplication", "http://localhost:59169"]
);

This is because the Java process pertaining to the SpringBoot application uses the real path of jars as the classpath arg. In other words, the temp directory /var/folders/... (which contains jar files) is a symlink and resolves to /private/var/folders/... on MacOS. We might use the real path instead of the absolute path and then compare the args.

Eclipse JKube version

SNAPSHOT

Component

JKube Kit

Apache Maven version

None

Gradle version

None

Steps to reproduce

  1. It requires MacOS
  2. Run tests from SpringBootWatcherIntegrationTest inside jkube-jit module
  3. Observe the error

Expected behavior

Tests inside SpringBootWatcherIntegrationTest should pass on MacOS as well as Linux.

Runtime

other (please specify in additional context)

Kubernetes API Server version

1.25.3

Environment

macOS

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

rohanKanojia commented 2 months ago

Shall we create an epic for fixing tests on MacOs? I think we have a similar issue for windows

arman-yekkehkhani commented 2 months ago

@rohanKanojia sounds like a good idea!