From 8db6907f81f5b688a703f8f7d050cebaebd6d714 Mon Sep 17 00:00:00 2001 From: Anusha Hegde <ahegde@newrelic.com> Date: Fri, 10 Jan 2025 16:53:46 +0530 Subject: [PATCH] fixes --- e2e-tests/common-scripts.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/e2e-tests/common-scripts.sh b/e2e-tests/common-scripts.sh index 7a6ff8b..af2f9c0 100755 --- a/e2e-tests/common-scripts.sh +++ b/e2e-tests/common-scripts.sh @@ -78,19 +78,16 @@ create_cloudwatch_log_event() { echo "Creating log event in CloudWatch Log Group" - # Check if the log stream exists + # Check if the log stream exists else create one log_stream_exists=$(aws logs describe-log-streams --log-group-name "$log_group_name" --log-stream-name-prefix "$log_stream_name" --query "logStreams[?logStreamName=='$log_stream_name'] | length(@)" --output text) - if [ $log_stream_exists -eq 0 ]; then + if [ -n "$log_stream_exists" ] && [ "$log_stream_exists" -eq 0 ]; then + echo "Log stream does not exist. Creating log stream: $log_stream_name" aws logs create-log-stream --log-group-name "$log_group_name" --log-stream-name "$log_stream_name" - else - exit_with_error "Cloudwatch log stream: $log_stream_name in group: $log_group_name doesn't exist" fi - # Get the current timestamp in milliseconds timestamp=$(($(date +%s) * 1000 + $(date +%N) / 1000000)) - # Put log event aws logs put-log-events \ --log-group-name "$log_group_name" \ --log-stream-name "$log_stream_name" \