fix(tests): try to fix the auto_resume_tests yet again for integration tests
This commit is contained in:
parent
0bf384bbb1
commit
cad685bb47
|
|
@ -88,6 +88,20 @@ jobs:
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
- name: Wait for PostgreSQL to be ready
|
||||||
|
run: |
|
||||||
|
until pg_isready -h localhost -p 5432 -U postgres; do
|
||||||
|
echo "Waiting for PostgreSQL..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "PostgreSQL is ready!"
|
||||||
|
|
||||||
|
- name: Verify database connection
|
||||||
|
run: |
|
||||||
|
echo "Testing database connection..."
|
||||||
|
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d readur_test -c "SELECT version();"
|
||||||
|
echo "Database connection successful!"
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
cargo test --test '*' -- --test-threads=1
|
cargo test --test '*' -- --test-threads=1
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,12 @@ use readur::{
|
||||||
|
|
||||||
/// Create a test app state
|
/// Create a test app state
|
||||||
async fn create_test_app_state() -> Arc<AppState> {
|
async fn create_test_app_state() -> Arc<AppState> {
|
||||||
|
let database_url = std::env::var("TEST_DATABASE_URL")
|
||||||
|
.or_else(|_| std::env::var("DATABASE_URL"))
|
||||||
|
.unwrap_or_else(|_| "postgres://postgres:postgres@localhost:5432/readur_test".to_string());
|
||||||
|
|
||||||
let config = Config {
|
let config = Config {
|
||||||
database_url: "sqlite::memory:".to_string(),
|
database_url,
|
||||||
server_address: "127.0.0.1:8080".to_string(),
|
server_address: "127.0.0.1:8080".to_string(),
|
||||||
jwt_secret: "test_secret".to_string(),
|
jwt_secret: "test_secret".to_string(),
|
||||||
upload_path: "/tmp/test_uploads".to_string(),
|
upload_path: "/tmp/test_uploads".to_string(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue