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 case in ExternalCommandTest failing on MacOS #3006

Closed
arman-yekkehkhani opened this issue May 1, 2024 · 5 comments · Fixed by #3070
Closed

Test case in ExternalCommandTest failing on MacOS #3006

arman-yekkehkhani opened this issue May 1, 2024 · 5 comments · Fixed by #3070
Assignees
Labels
bug Something isn't working
Milestone

Comments

@arman-yekkehkhani
Copy link
Contributor

Describe the bug

When running test execute_whenCommandFailed_thenThrowException in class ExternalCommandTest on MacOS, it fails. It does not happen on Ubuntu. The reason for that is the inconsistent behaviour of command ls in the occasion of failure on these operating systems.

If we try to run ls in GNU with a nonexistent file as an argument, it fails with exit code 2:

$ ls idonotexist || echo $?
ls: cannot access 'idonotexist': No such file or directory
2

While on MacOS, the exit code is 1:

$ ls idonotexist || echo $?
ls: idonotexist: No such file or directory
1

Eclipse JKube version

SNAPSHOT

Component

JKube Kit

Apache Maven version

None

Gradle version

None

Steps to reproduce

  1. Use MacOS
  2. Run tests inside class ExternalCommandTest
  3. Test case execute_whenCommandFailed_thenThrowException will fail

Expected behavior

Either the test case should be platform-independent or disabled on MacOS (like Windows)

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

@arman-yekkehkhani arman-yekkehkhani added the bug Something isn't working label May 1, 2024
@arman-yekkehkhani
Copy link
Contributor Author

@rohanKanojia Should it be disabled on MacOS as well as Windows?

@rohanKanojia
Copy link
Member

@arman-yekkehkhani : Okay, let's disable it on MacOS. Also, I would add an equivalent test for MacOS (@EnabledOnOs(OS.MAC)) as well that verifies behavior on MacOS.

@arman-yekkehkhani
Copy link
Contributor Author

@rohanKanojia Thx! Could you assign it to me? I can make a PR for that.

@manusa
Copy link
Member

manusa commented May 13, 2024

Maybe we can just check that the exit code is not 0 which will work in both OSs

@manusa
Copy link
Member

manusa commented May 13, 2024

Or just modify the command for something that's cross-os (*nix/bsd) compatible.

arman-yekkehkhani added a commit to arman-yekkehkhani/jkube that referenced this issue May 17, 2024
…ode, issue eclipse-jkube#3006

Signed-off-by: arman-yekkehkhani <arman.yekkehkhani@gmail.com>
@manusa manusa added this to the 1.17.0 milestone May 17, 2024 — with automated-tasks
manusa pushed a commit that referenced this issue May 17, 2024
…ndTest, issue #3006

Signed-off-by: arman-yekkehkhani <arman.yekkehkhani@gmail.com>
kiratkumar47 pushed a commit to kiratkumar47/jkube that referenced this issue May 20, 2024
…ndTest, issue eclipse-jkube#3006

Signed-off-by: arman-yekkehkhani <arman.yekkehkhani@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants