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

Fix the startserv script if server is already running #25027

Merged

Conversation

OndroMih
Copy link
Contributor

@OndroMih OndroMih commented Jul 5, 2024

Also report the error immediately, don't run the command again

Adds tests for the startserv script. For that, improves the process manager to allow waiting until a text it output instead of waiting for the process to complete.

OndroMih added 2 commits July 5, 2024 12:52
Also report the error immediately, don't run the command again

Adds tests for the startserv script. For that, improves the process manager to allow waiting until a text it output instead of waiting for the process to complete.
ProcessManager pm = new ProcessManager("sh", "-c", "echo \"start\nhello\ncontinue\"");
pm.setEcho(false);
pm.setTextToWaitFor("hello");
int exitCode = assertDoesNotThrow(pm::execute);
Thread.sleep(ofSeconds(1));
Thread.sleep(sleepTimeSeconds * 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can write also 1_000L, no need to create a variable if it doesn't have any other usage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to do that first, but then I saw that other test method follow this pattern so I did it this way. If we used Java 21, I would rather use Duration, but with millis I’m not sure which approach is better.

@dmatej dmatej added this to the 7.0.16 milestone Jul 15, 2024
@dmatej dmatej added the bug Something isn't working label Jul 15, 2024
@arjantijms arjantijms merged commit 204f5e6 into eclipse-ee4j:master Jul 16, 2024
2 checks passed
@OndroMih OndroMih deleted the ondromih-fix-startserv-if-error branch August 12, 2024 21:34
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 this pull request may close these issues.

3 participants