Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/admin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ mod tests {
use tower::ServiceExt;

async fn test_state() -> Arc<crate::state::AppState> {
let mut config = crate::config::Config::from_env().expect("default config loads");
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().expect("default config loads")
};
config.require_relay_membership = false;
config.redis_url = "redis://127.0.0.1:1".to_string();
config.admin = Some(crate::config::AdminConfig {
Expand Down
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3446,7 +3446,10 @@ mod tests {
///
/// Returns `None` when local Postgres is not reachable.
async fn bridge_handler_test_state() -> Option<Arc<crate::state::AppState>> {
let mut config = crate::config::Config::from_env().ok()?;
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().ok()?
};
config.database_url = TEST_DB_URL.to_string();
// Use the real local Redis so enforce_http_admission can pass.
config.redis_url =
Expand Down
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/git/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,10 @@ printf '%s' "$HMAC_INPUT" | openssl dgst -sha256 -hmac "{secret}" -hex 2>/dev/nu
const TEST_DB_URL: &str = "postgres://buzz:buzz_dev@localhost:5432/buzz"; // sadscan:disable np.postgres.1

async fn policy_test_state() -> Arc<AppState> {
let mut config = crate::config::Config::from_env().expect("default config loads");
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().expect("default config loads")
};
config.require_relay_membership = false;
config.redis_url = "redis://127.0.0.1:1".to_string();
config.database_url = std::env::var("BUZZ_TEST_DATABASE_URL")
Expand Down
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/invites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,10 @@ mod tests {
/// Build a closed-relay (`require_relay_membership = true`) test state with
/// a fresh community on `host`; returns `None` when Postgres is unavailable.
async fn invite_test_state(host: &str) -> Option<Arc<AppState>> {
let mut config = crate::config::Config::from_env().ok()?;
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().ok()?
};
let database_url = std::env::var("BUZZ_TEST_DATABASE_URL")
.or_else(|_| std::env::var("DATABASE_URL"))
.unwrap_or_else(|_| TEST_DB_URL.to_string());
Expand Down
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,10 @@ mod tests {
}

async fn test_state() -> Arc<AppState> {
let mut config = crate::config::Config::from_env().expect("default config loads");
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().expect("default config loads")
};
config.require_relay_membership = false;
config.redis_url = "redis://127.0.0.1:1".to_string();
config.media_uploads_per_minute = 1;
Expand Down
5 changes: 4 additions & 1 deletion crates/buzz-relay/src/api/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,10 @@ mod tests {
}

async fn operator_test_state(operator_keys: &[Keys]) -> Option<Arc<AppState>> {
let mut config = crate::config::Config::from_env().ok()?;
let mut config = {
let _env = crate::test_env::EnvGuard::new();
crate::config::Config::from_env().ok()?
};
config.database_url = TEST_DB_URL.to_string();
config.redis_url = "redis://127.0.0.1:1".to_string();
config.relay_url = "wss://tenant.example".to_string();
Expand Down
Loading