feat: always use test configuration during tests
This commit is contained in:
@@ -13,7 +13,12 @@ static CONFIG_BUILDER: Lazy<RwLock<Config>> = Lazy::new(|| {
|
|||||||
FileFormat::Toml,
|
FileFormat::Toml,
|
||||||
));
|
));
|
||||||
|
|
||||||
if std::path::Path::new("Revolt.toml").exists() {
|
if std::env::var("TEST_DB").is_ok() {
|
||||||
|
builder = builder.add_source(File::from_str(
|
||||||
|
include_str!("../Revolt.test.toml"),
|
||||||
|
FileFormat::Toml,
|
||||||
|
));
|
||||||
|
} else if std::path::Path::new("Revolt.toml").exists() {
|
||||||
builder = builder.add_source(File::new("Revolt.toml", FileFormat::Toml));
|
builder = builder.add_source(File::new("Revolt.toml", FileFormat::Toml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ mod tests {
|
|||||||
db.migrate_database().await.unwrap();
|
db.migrate_database().await.unwrap();
|
||||||
|
|
||||||
// Migrate the existing database
|
// Migrate the existing database
|
||||||
db.migrate_database().await.unwrap()
|
db.migrate_database().await.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
use revolt_result::{create_error, Result, Error};
|
use revolt_result::{create_error, Result};
|
||||||
|
|
||||||
|
#[cfg(feature = "rocket-impl")]
|
||||||
|
use revolt_result::Error;
|
||||||
|
|
||||||
use async_std::sync::Mutex;
|
use async_std::sync::Mutex;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|||||||
Reference in New Issue
Block a user