Skip to content

Commit

Permalink
remove queue url const
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvsadana committed Aug 23, 2024
1 parent feb746b commit 3438448
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 8 additions & 10 deletions crates/orchestrator/src/tests/alerts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
use crate::config::config;
use crate::tests::common::{get_sns_client, get_sqs_client, SNS_ALERT_TEST_QUEUE, SNS_ALERT_TEST_QUEUE_URL};
use crate::tests::common::{get_sns_client, get_sqs_client};
use crate::tests::config::TestConfigBuilder;
use aws_sdk_sqs::types::QueueAttributeName::QueueArn;
use rstest::rstest;
use std::time::Duration;
use tokio::time::sleep;
use utils::env_utils::get_env_var_or_panic;

pub const SNS_ALERT_TEST_QUEUE: &str = "orchestrator_sns_alert_testing_queue";

#[rstest]
#[tokio::test]
async fn sns_alert_subscribe_to_topic_receive_alert_works() {
TestConfigBuilder::new().build().await;

let sqs_client = get_sqs_client().await;
sqs_client.create_queue().queue_name(SNS_ALERT_TEST_QUEUE).send().await.unwrap();
let queue = sqs_client.create_queue().queue_name(SNS_ALERT_TEST_QUEUE).send().await.unwrap();
let queue_url = queue.queue_url().unwrap();

let sns_client = get_sns_client().await;
let config = config().await;

let queue_attributes = sqs_client
.get_queue_attributes()
.queue_url(SNS_ALERT_TEST_QUEUE_URL)
.attribute_names(QueueArn)
.send()
.await
.unwrap();
let queue_attributes =
sqs_client.get_queue_attributes().queue_url(queue_url).attribute_names(QueueArn).send().await.unwrap();

let queue_arn = queue_attributes.attributes().unwrap().get(&QueueArn).unwrap();

Expand All @@ -50,7 +48,7 @@ async fn sns_alert_subscribe_to_topic_receive_alert_works() {
// Checking the queue for message
let receive_message_result = sqs_client
.receive_message()
.queue_url(SNS_ALERT_TEST_QUEUE_URL)
.queue_url(queue_url)
.max_number_of_messages(1)
.send()
.await
Expand Down
4 changes: 0 additions & 4 deletions crates/orchestrator/src/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ use crate::jobs::types::JobType::DataSubmission;
use crate::jobs::types::{ExternalId, JobItem};
use crate::queue::job_queue::{JOB_PROCESSING_QUEUE, JOB_VERIFICATION_QUEUE};

pub const SNS_ALERT_TEST_QUEUE: &str = "orchestrator_sns_alert_testing_queue";
pub const SNS_ALERT_TEST_QUEUE_URL: &str =
"http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/orchestrator_sns_alert_testing_queue";

#[fixture]
pub fn default_job_item() -> JobItem {
JobItem {
Expand Down

0 comments on commit 3438448

Please sign in to comment.