torrust-index icon indicating copy to clipboard operation
torrust-index copied to clipboard

Error running E2E tests with MySQL: Test server is not running on localhost:3001

Open josecelano opened this issue 1 year ago • 3 comments

Sometimes, we get the error "Test server is not running on localhost:3001" when running the E2E test on the GitHub runner.

I have also got the error running them locally with:

./contrib/dev-tools/container/e2e/mysql/run-e2e-tests.sh

However, less frequently than in the runner.

The error is not deterministic. When you rerun the tests, it works. I guess it must be a timeout, or we don't wait enough for the server to be ready to accept requests.

Usually, some tests fail, and some don't.

Error example:

---- e2e::web::api::v1::contexts::category::contract::it_should_not_allow_non_admins_to_delete_categories stdout ----
thread 'e2e::web::api::v1::contexts::category::contract::it_should_not_allow_non_admins_to_delete_categories' panicked at tests/environments/shared.rs:20:9:
Test server is not running on localhost:3001

josecelano avatar May 15 '24 07:05 josecelano

I've added the error to the output but it's not very useful:

---- e2e::web::api::v1::contexts::category::contract::it_should_not_allow_adding_empty_categories stdout ----
thread 'e2e::web::api::v1::contexts::category::contract::it_should_not_allow_adding_empty_categories' panicked at tests/environments/shared.rs:21:25:
Test server is not running on localhost:3001. Error: error sending request for url (http://localhost:3001/v1)

josecelano avatar May 21 '24 10:05 josecelano

The PR didn't work.

josecelano avatar Jul 29 '24 11:07 josecelano

I've temporarily moved the execution of E2E tests to a new workflow. See https://github.com/torrust/torrust-index/pull/736. Surprisingly, they are now passing.

There must be a problem with containers after executing E2E tests with SQLite. However, containers for the second round with MySQL seem to be running fine.

josecelano avatar Sep 24 '24 10:09 josecelano