Closed morenol closed 3 years ago
Perhaps is a good idea merging this after #21?
@morenol theres something in regards to running multiple instances of the server in parallel during tests I think I'm not aware of, if you don't mind elaborating a bit on that, perhaps I'm missing something
@morenol theres something in regards to running multiple instances of the server in parallel during tests I think I'm not aware of, if you don't mind elaborating a bit on that, perhaps I'm missing something
The idea is to create an instance of the server for each test in order to isolate the feature that I want to test. Think about those tests as integration tests
@morenol theres something in regards to running multiple instances of the server in parallel during tests I think I'm not aware of, if you don't mind elaborating a bit on that, perhaps I'm missing something
The idea is to create an instance of the server for each test in order to isolate the feature that I want to test. Think about those tests as integration tests
Thing is that by doing this approach we are going over some optimizations an issues Actix Runtime already have solved on top of Tokio as well. We should rely on Actix Runtime to accomplish this (here) which already takes care of this and have support for unit and integration tests as well.
Actix Runtime acts as a proxy to Tokio runtime and takes care of futures emitted during our tests as well: https://github.com/actix/actix-net/blob/master/actix-rt/src/system.rs
By spawning our own Tokio task we have to handle all of these edge cases ourselves.
Here is how Actix recommends how tests must be implemented: https://actix.rs/docs/testing/
Thing is that by doing this approach we are going over some optimizations an issues Actix Runtime already have solved on top of Tokio as well. We should rely on Actix Runtime to accomplish this (here) which already takes care of this and have support for unit and integration tests as well.
Thanks, I will take a look to those links!
With #26 we should be able to merge this, @morenol
This PR adds a health_check endpoint. Right now we are only testing the connection with the database.
Fixes https://github.com/rust-lang-ve/hilow/issues/16