Skip to content

Commit

Permalink
Merge pull request #15 from svix/onelson/sqs-default-test-cfg
Browse files Browse the repository at this point in the history
add fallback env vars for testing SQS
  • Loading branch information
svix-onelson authored Aug 10, 2023
2 parents 6f460b7 + ab9fcd6 commit 8934ac0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions omniqueue/tests/sqs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ use omniqueue::{
use serde::{Deserialize, Serialize};

const ROOT_URL: &str = "http://localhost:9324";
const DEFAULT_CFG: [(&str, &str); 3] = [
("AWS_DEFAULT_REGION", "localhost"),
("AWS_ACCESS_KEY_ID", "x"),
("AWS_SECRET_ACCESS_KEY", "x"),
];

/// Returns a [`QueueBuilder`] configured to connect to the SQS instance spawned by the file
/// `testing-docker-compose.yaml` in the root of the repository.
///
/// Additionally this will make a temporary queue on that instance for the duration of the test such
/// as to ensure there is no stealing.w
async fn make_test_queue() -> QueueBuilder<SqsQueueBackend, Static> {
for (var, val) in &DEFAULT_CFG {
if std::env::var(var).is_err() {
std::env::set_var(var, val);
}
}

let config = aws_config::from_env().endpoint_url(ROOT_URL).load().await;
let client = Client::new(&config);

Expand Down

0 comments on commit 8934ac0

Please sign in to comment.