Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fallback env vars for testing SQS #15

Merged
merged 1 commit into from
Aug 10, 2023
Merged
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
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
Loading