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

RedisServer is ready support #475

Closed
penev-ff opened this issue Jun 21, 2024 · 3 comments · Fixed by #483
Closed

RedisServer is ready support #475

penev-ff opened this issue Jun 21, 2024 · 3 comments · Fixed by #483

Comments

@penev-ff
Copy link

Currently, the RedisServer class lacks a convenient mechanism to notify external code when the server has fully started and is ready to accept requests. I would be happy if a method or mechanism is introduced in the RedisServer class that signals when the server has completed its startup and initialization processes.

Example.

// Example if server is already running:
server.stop();
// - Here assert request that are using the mock server fails
server.start();
Awaitility.await().until(server::isReady);
// Proceed with assertions or operations requiring the server to be operational
@inponomarev
Copy link
Collaborator

  1. Do I get this right that you are getting the connection error after server.start() as the connection attempt is made before the port is open?
  2. What do you think if server.start() will simply block until the server is ready instead?

@inponomarev
Copy link
Collaborator

Ok I have investigated that if tests are run in the same thread, server is ready to accept connections after start().

However, there are two corner case usages for isReady:

  1. If server is started in one thread, but is being connect from a separate thread.
  2. If user "forgets" about the state of the server, e. g. doesn't know if start or stop has been called.

I have implemented isRunning method in #483

@penev-ff
Copy link
Author

penev-ff commented Jul 6, 2024

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants