Skip to content

Tests: Wait until server has started? #1701

Answered by bes
bes asked this question in Q&A
Jan 16, 2023 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

Thanks @davidpdrsn but I don't understand how those resources would help me.

I forgot to add in my code above that I am already doing

reqwest::get(format!("http://127.0.0.1:{SERVER_PORT}/{path}"))
            .await?
            .error_for_status()?

But unless I wait for a little while before issuing the request, the test fails with this:

---- server::tests::test_server stdout ----
Error: error sending request for url (http://127.0.0.1:51130/somepath): error trying to connect: tcp connect error: Connection refused (os error 61)

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@davidpdrsn
Comment options

@bes
Comment options

Answer selected by bes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants