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

Kinesis Firehose Sink IT Test #1155

Merged
merged 2 commits into from
Nov 14, 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
2 changes: 2 additions & 0 deletions it-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tests:
./timer-aws-sqs-fifo-it-test.sh $(camel-version)
cd aws/aws-sns/sink/ && \
./timer-aws-sns-it-test.sh $(camel-version)
cd aws/aws-kinesis-firehose/sink/ && \
./timer-aws-kinesis-firehose-it-test.sh $(camel-version)
./scripts/results.sh
rm -rf tests

Expand Down
86 changes: 86 additions & 0 deletions it-tests/aws/aws-kinesis-firehose/sink/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* 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 "kinesis_delivery_stream_name" {
type = string
default = "kinesis-camel-test-123"
}

resource "aws_kinesis_firehose_delivery_stream" "extended_s3_stream" {
name = var.kinesis_delivery_stream_name
destination = "extended_s3"

extended_s3_configuration {
role_arn = aws_iam_role.firehose_role.arn
bucket_arn = aws_s3_bucket.bucket.arn
}
}

variable "s3_bucket_delivery_stream_name" {
type = string
default = "s3-camel-test-123"
}


resource "aws_s3_bucket" "bucket" {
bucket = var.s3_bucket_delivery_stream_name
}

resource "aws_iam_role" "firehose_role" {
name = "firehose_test_role"

assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "firehose.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}

output "Kinesis-firehose-dist-stream" {
value = aws_kinesis_firehose_delivery_stream.extended_s3_stream.arn
description = "The Kinesis Stream ARN"
}
output "S3-Bucket" {
value = aws_s3_bucket.bucket.id
description = "The S3 Bucket"
}
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-kinesis-firehose-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-kinesis-firehose.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-kinesis-firehose-it-test.result ;
else
mkdir -p ../../../tests/
echo "Test failed" > ../../../tests/timer-aws-kinesis-firehose-it-test.result ;
fi

jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-aws-kinesis-firehose

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

cat ../../../tests/timer-aws-kinesis-firehose-it-test.result
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-kinesis-firehose-sink"
parameters:
streamName: "kinesis-camel-test-123"
useDefaultCredentialsProvider: true
region: "eu-west-1"