Skip to content

Commit

Permalink
sort arrays when comparing
Browse files Browse the repository at this point in the history
Signed-off-by: balonik <[email protected]>
  • Loading branch information
balonik authored and jszwedko committed Aug 23, 2024
1 parent 114163f commit fb77faf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion scripts/integration/aws/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:
S3_ADDRESS: http://mock-localstack:4566
SQS_ADDRESS: http://mock-localstack:4566
SNS_ADDRESS: http://mock-localstack:4566
WATCHLOGS_ADDRESS: http://mock-localstack:4566

matrix:
version: [latest]
Expand Down
34 changes: 17 additions & 17 deletions src/sinks/aws_cloudwatch_logs/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use crate::{

const GROUP_NAME: &str = "vector-cw";

fn watchlogs_address() -> String {
std::env::var("WATCHLOGS_ADDRESS").unwrap_or_else(|_| "http://localhost:6000".into())
fn cloudwatch_address() -> String {
std::env::var("CLOUDWATCH_ADDRESS").unwrap_or_else(|_| "http://localhost:4566".into())
}

#[tokio::test]
Expand All @@ -39,7 +39,7 @@ async fn cloudwatch_insert_log_event() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from(stream_name.as_str()).unwrap(),
group_name: Template::try_from(GROUP_NAME).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -77,7 +77,7 @@ async fn cloudwatch_insert_log_event() {
.map(|e| e.message.unwrap())
.collect::<Vec<_>>();

assert_eq!(output_lines, input_lines);
assert_eq!(output_lines.sort(), input_lines.sort());

Check failure on line 80 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable

Check failure on line 80 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `input_lines` as mutable, as it is not declared as mutable
}

#[tokio::test]
Expand All @@ -90,7 +90,7 @@ async fn cloudwatch_insert_log_events_sorted() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from(stream_name.as_str()).unwrap(),
group_name: Template::try_from(GROUP_NAME).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -153,7 +153,7 @@ async fn cloudwatch_insert_log_events_sorted() {
// readjust input_lines in the same way we have readjusted timestamps.
let first = input_lines.remove(0);
input_lines.push(first);
assert_eq!(output_lines, input_lines);
assert_eq!(output_lines.sort(), input_lines.sort());

Check failure on line 156 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable
}

#[tokio::test]
Expand All @@ -166,7 +166,7 @@ async fn cloudwatch_insert_out_of_range_timestamp() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from(stream_name.as_str()).unwrap(),
group_name: Template::try_from(GROUP_NAME).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -230,7 +230,7 @@ async fn cloudwatch_insert_out_of_range_timestamp() {
.map(|e| e.message.unwrap())
.collect::<Vec<_>>();

assert_eq!(output_lines, lines);
assert_eq!(output_lines.sort(), lines.sort());

Check failure on line 233 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable
}

#[tokio::test]
Expand All @@ -243,7 +243,7 @@ async fn cloudwatch_dynamic_group_and_stream_creation() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from(stream_name.as_str()).unwrap(),
group_name: Template::try_from(group_name.as_str()).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -281,7 +281,7 @@ async fn cloudwatch_dynamic_group_and_stream_creation() {
.map(|e| e.message.unwrap())
.collect::<Vec<_>>();

assert_eq!(output_lines, input_lines);
assert_eq!(output_lines.sort(), input_lines.sort());

Check failure on line 284 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable

Check failure on line 284 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `input_lines` as mutable, as it is not declared as mutable
}

#[tokio::test]
Expand All @@ -299,7 +299,7 @@ async fn cloudwatch_insert_log_event_batched() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from(stream_name.as_str()).unwrap(),
group_name: Template::try_from(group_name.as_str()).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -337,7 +337,7 @@ async fn cloudwatch_insert_log_event_batched() {
.map(|e| e.message.unwrap())
.collect::<Vec<_>>();

assert_eq!(output_lines, input_lines);
assert_eq!(output_lines.sort(), input_lines.sort());

Check failure on line 340 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable

Check failure on line 340 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `input_lines` as mutable, as it is not declared as mutable
}

#[tokio::test]
Expand All @@ -350,7 +350,7 @@ async fn cloudwatch_insert_log_event_partitioned() {
let config = CloudwatchLogsSinkConfig {
group_name: Template::try_from(GROUP_NAME).unwrap(),
stream_name: Template::try_from(format!("{}-{{{{key}}}}", stream_name)).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand Down Expand Up @@ -405,7 +405,7 @@ async fn cloudwatch_insert_log_event_partitioned() {
.map(|(_, e)| e)
.collect::<Vec<_>>();

assert_eq!(output_lines, expected_output);
assert_eq!(output_lines.sort(), expected_output.sort());

Check failure on line 408 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `output_lines` as mutable, as it is not declared as mutable

Check failure on line 408 in src/sinks/aws_cloudwatch_logs/integration_tests.rs

View workflow job for this annotation

GitHub Actions / Checks

cannot borrow `expected_output` as mutable, as it is not declared as mutable

let response = create_client_test()
.await
Expand All @@ -430,7 +430,7 @@ async fn cloudwatch_insert_log_event_partitioned() {
.map(|(_, e)| e)
.collect::<Vec<_>>();

assert_eq!(output_lines, expected_output);
assert_eq!(output_lines.sort(), expected_output.sort());
}

#[tokio::test]
Expand All @@ -443,7 +443,7 @@ async fn cloudwatch_healthcheck() {
let config = CloudwatchLogsSinkConfig {
stream_name: Template::try_from("test-stream").unwrap(),
group_name: Template::try_from(GROUP_NAME).unwrap(),
region: RegionOrEndpoint::with_both("us-east-1", watchlogs_address().as_str()),
region: RegionOrEndpoint::with_both("us-east-1", cloudwatch_address().as_str()),
encoding: TextSerializerConfig::default().into(),
create_missing_group: true,
create_missing_stream: true,
Expand All @@ -464,7 +464,7 @@ async fn cloudwatch_healthcheck() {
async fn create_client_test() -> CloudwatchLogsClient {
let auth = AwsAuthentication::test_auth();
let region = Some(Region::new("us-east-1"));
let endpoint = Some(watchlogs_address());
let endpoint = Some(cloudwatch_address());
let proxy = ProxyConfig::default();

create_client::<CloudwatchLogsClientBuilder>(&auth, region, endpoint, &proxy, &None, &None)
Expand Down

0 comments on commit fb77faf

Please sign in to comment.