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

IT Tests: Add tests for AWS SNS #1152

Merged
merged 3 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion it-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/ && \
Expand All @@ -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

Expand Down
9 changes: 6 additions & 3 deletions it-tests/aws/aws-kinesis/sink/timer-aws-kinesis-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ 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

cd terraform/
terraform destroy -auto-approve
cd ../

cat ../../../tests/timer-aws-kinesis-it-test.result
4 changes: 4 additions & 0 deletions it-tests/aws/aws-kinesis/source/aws-kinesis-log-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
5 changes: 4 additions & 1 deletion it-tests/aws/aws-s3/sink/timer-aws-s3-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
4 changes: 4 additions & 0 deletions it-tests/aws/aws-s3/source/aws-s3-log-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
51 changes: 51 additions & 0 deletions it-tests/aws/aws-sns/sink/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}

37 changes: 37 additions & 0 deletions it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/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`
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
29 changes: 29 additions & 0 deletions it-tests/aws/aws-sns/sink/timer-aws-sns.yaml
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 4 additions & 1 deletion it-tests/aws/aws-sqs-fifo/sink/timer-aws-sqs-fifo-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
5 changes: 4 additions & 1 deletion it-tests/aws/aws-sqs/sink/timer-aws-sqs-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
4 changes: 4 additions & 0 deletions it-tests/aws/aws-sqs/source/aws-sqs-log-it-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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