From 85fb76535c100d3e1efb54fc29bfd67ec59ae66b Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 10 Nov 2022 13:22:45 +0100 Subject: [PATCH 1/3] Added AWS Sink SNS Test Signed-off-by: Andrea Cosentino --- it-tests/aws/aws-sns/sink/terraform/main.tf | 51 +++++++++++++++++++ .../aws/aws-sns/sink/timer-aws-sns-it-test.sh | 38 ++++++++++++++ it-tests/aws/aws-sns/sink/timer-aws-sns.yaml | 29 +++++++++++ 3 files changed, 118 insertions(+) create mode 100644 it-tests/aws/aws-sns/sink/terraform/main.tf create mode 100755 it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh create mode 100644 it-tests/aws/aws-sns/sink/timer-aws-sns.yaml diff --git a/it-tests/aws/aws-sns/sink/terraform/main.tf b/it-tests/aws/aws-sns/sink/terraform/main.tf new file mode 100644 index 000000000..ccfa83659 --- /dev/null +++ b/it-tests/aws/aws-sns/sink/terraform/main.tf @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.27" + } + } + + required_version = ">= 0.14.9" +} + +provider "aws" { + profile = "default" + region = "eu-west-1" +} + +variable "sns_topic_name" { + type = string + default = "s3-camel-test-123" +} + + +data "aws_caller_identity" "current" {} + +# Create a new SNS TOPIC +resource "aws_sns_topic" "MySNSTopic" { + name = var.sns_topic_name +} + +output "SNS-topic" { + value = aws_sns_topic.MySNSTopic.id + description = "The SQS Queue" +} + diff --git a/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh new file mode 100755 index 000000000..d840f4287 --- /dev/null +++ b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo $0: usage: timer-aws-sns-it-test.sh camel-version + exit 1 +fi + +camel_version=$1 + +cd terraform/ +terraform init +terraform apply -auto-approve +cd ../ + +jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel run timer-aws-sns.yaml & + +sleep 10 + +variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` +success=`echo $variable | cut -d' ' -f11` +fail=`echo $variable | cut -d' ' -f12` +echo $success $fail +if [[ $success == 5 && $fail == 0 ]] +then + mkdir -p ../../../tests/ + echo "Test Successful" > ../../../tests/timer-aws-sns-it-test.result ; +else + mkdir -p ../../../tests/ + echo "Test failed" > ../../../tests/timer-aws-sns-it-test.result ; +fi + +jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws-sns + +cd terraform/ +terraform destroy -auto-approve +cd ../ + +cat ../../../tests/timer-aws-sns-it-test.result diff --git a/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml b/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml new file mode 100644 index 000000000..338e10214 --- /dev/null +++ b/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml @@ -0,0 +1,29 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +- route: + from: + uri: "timer://foo?delay=0&fixedRate=true&period=1000&repeatCount=5" + steps: + - set-body: + constant: "test" + - to: + uri: "kamelet:aws-sns-sink" + parameters: + topicNameOrArn: "s3-camel-test-123" + useDefaultCredentialsProvider: true + region: "eu-west-1" From 50c3e8b1b29e09d4d93f42af404cfd1d6b9aa615 Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 10 Nov 2022 13:30:52 +0100 Subject: [PATCH 2/3] Improved testing in IT Tests Signed-off-by: Andrea Cosentino --- it-tests/Makefile | 4 +++- .../aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh | 9 ++++++--- .../aws/aws-kinesis/source/aws-kinesis-log-it-test.sh | 4 ++++ it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh | 5 ++++- it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh | 4 ++++ .../aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh | 5 ++++- it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh | 5 ++++- it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh | 4 ++++ 8 files changed, 33 insertions(+), 7 deletions(-) diff --git a/it-tests/Makefile b/it-tests/Makefile index d45d17570..a15686a04 100644 --- a/it-tests/Makefile +++ b/it-tests/Makefile @@ -14,7 +14,7 @@ # limitations under the License. tests: - mkdir tests + mkdir -p tests cd aws/aws-s3/source/ && \ ./aws-s3-log-it-test.sh $(camel-version) cd aws/aws-s3/sink/ && \ @@ -29,6 +29,8 @@ tests: ./timer-aws-sqs-it-test.sh $(camel-version) cd aws/aws-sqs-fifo/sink/ && \ ./timer-aws-sqs-fifo-it-test.sh $(camel-version) + cd aws/aws-sns/sink/ && \ + ./timer-aws-sns-it-test.sh $(camel-version) ./scripts/results.sh rm -rf tests diff --git a/it-tests/aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh b/it-tests/aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh index 75f871dea..3137dd3b8 100755 --- a/it-tests/aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh +++ b/it-tests/aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh @@ -19,12 +19,13 @@ sleep 10 variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` -echo $success $fail if [[ $success == 5 && $fail == 0 ]] then - echo "Test Successful" > ../../../tests/timer-aws-kinesis-it-test.result; + mkdir -p ../../../tests/ + echo "Test Successful" > ../../../tests/timer-aws-kinesis-it-test.result ; else - echo "Test failed" > ../../../tests/timer-aws-kinesis-it-test.result; + mkdir -p ../../../tests/ + echo "Test failed" > ../../../tests/timer-aws-kinesis-it-test.result ; fi jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws-kinesis @@ -32,3 +33,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/timer-aws-kinesis-it-test.result diff --git a/it-tests/aws/aws-kinesis/source/aws-kinesis-log-it-test.sh b/it-tests/aws/aws-kinesis/source/aws-kinesis-log-it-test.sh index c815692c9..f8a4a529f 100755 --- a/it-tests/aws/aws-kinesis/source/aws-kinesis-log-it-test.sh +++ b/it-tests/aws/aws-kinesis/source/aws-kinesis-log-it-test.sh @@ -29,8 +29,10 @@ success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/aws-kinesis-log-it-test.result; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/aws-kinesis-log-it-test.result; fi @@ -39,3 +41,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop aws-kines cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/aws-kinesis-log-it-test.result diff --git a/it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh b/it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh index 9bdb62767..c34a18135 100755 --- a/it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh +++ b/it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh @@ -19,11 +19,12 @@ sleep 10 variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` -echo $success $fail if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/timer-aws-s3-it-test.result ; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/timer-aws-s3-it-test.result ; fi @@ -32,3 +33,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/timer-aws-s3-it-test.result diff --git a/it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh b/it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh index 2979f7151..4819d4805 100755 --- a/it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh +++ b/it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh @@ -29,8 +29,10 @@ success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/aws-s3-log-it-test.result; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/aws-s3-log-it-test.result; fi @@ -39,3 +41,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop aws-s3-lo cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/aws-s3-log-it-test.result diff --git a/it-tests/aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh b/it-tests/aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh index 0d5cfb227..5072675f8 100755 --- a/it-tests/aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh +++ b/it-tests/aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh @@ -19,11 +19,12 @@ sleep 10 variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` -echo $success $fail if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/timer-aws-sqs-fifo-it-test.result ; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/timer-aws-sqs-fifo-it-test.result ; fi @@ -32,3 +33,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/timer-aws-sqs-fifo-it-test.result diff --git a/it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh b/it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh index 6dd38283a..042e3ab7a 100755 --- a/it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh +++ b/it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh @@ -19,11 +19,12 @@ sleep 10 variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` -echo $success $fail if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/timer-aws-sqs-it-test.result ; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/timer-aws-sqs-it-test.result ; fi @@ -32,3 +33,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/timer-aws-sqs-it-test.result diff --git a/it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh b/it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh index ebb18f4bb..3b9256403 100755 --- a/it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh +++ b/it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh @@ -31,8 +31,10 @@ success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` if [[ $success == 5 && $fail == 0 ]] then + mkdir -p ../../../tests/ echo "Test Successful" > ../../../tests/aws-sqs-log-it-test.result; else + mkdir -p ../../../tests/ echo "Test failed" > ../../../tests/aws-sqs-log-it-test.result; fi @@ -41,3 +43,5 @@ jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop aws-sqs-l cd terraform/ terraform destroy -auto-approve cd ../ + +cat ../../../tests/aws-sqs-log-it-test.result From 91d79c36d7f98bf49d6420ab5637e32228f8423b Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Thu, 10 Nov 2022 13:46:01 +0100 Subject: [PATCH 3/3] Fixed some stuff in AWS SNS Test Signed-off-by: Andrea Cosentino --- it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh index d840f4287..ce56cc5fa 100755 --- a/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh +++ b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh @@ -19,7 +19,6 @@ sleep 10 variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel get | tail -n +2` success=`echo $variable | cut -d' ' -f11` fail=`echo $variable | cut -d' ' -f12` -echo $success $fail if [[ $success == 5 && $fail == 0 ]] then mkdir -p ../../../tests/