forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x-pack/filebeat/input/awss3[integration test]Test integration tests o…
…n localstack (elastic#35727) * Test integration tests on localstack * Add localstack container in CI * fix panic in SQS input metrics * Add documentation * Fix PR comments
- Loading branch information
1 parent
c7c6f97
commit e924567
Showing
11 changed files
with
333 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '2.3' | ||
services: | ||
# This is a proxy used to block beats until all services are healthy. | ||
# See: https://github.com/docker/compose/issues/4369 | ||
proxy_dep: | ||
image: busybox | ||
depends_on: | ||
localstack: { condition: service_healthy } | ||
|
||
localstack: | ||
container_name: "${localstack_integration_test_container}" | ||
image: localstack/localstack:2.1.0 # Latest stable release | ||
ports: | ||
- "127.0.0.1:4566:4566" # LocalStack Gateway | ||
environment: | ||
- DEBUG=1 | ||
- DOCKER_HOST=unix:///var/run/docker.sock | ||
- LOCALSTACK_HOST=localhost | ||
- S3_HOSTNAME=localhost | ||
- PROVIDER_OVERRIDE_S3=asf | ||
volumes: | ||
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" | ||
- "/var/run/docker.sock:/var/run/docker.sock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exuo pipefail | ||
|
||
${HOME}/bin/docker-compose -f .ci/jobs/docker-compose.yml down -v | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exuo pipefail | ||
|
||
${HOME}/bin/docker-compose -f .ci/jobs/docker-compose.yml up -d | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
terraform/ | ||
outputs.yml | ||
outputs*.yml | ||
*.tfstate* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
provider "aws" { | ||
alias = "localstack" | ||
access_key = "bharat" | ||
secret_key = "bharat" | ||
region = "us-east-1" | ||
s3_use_path_style = true | ||
skip_credentials_validation = true | ||
skip_metadata_api_check = true | ||
skip_requesting_account_id = true | ||
|
||
endpoints { | ||
apigateway = "http://localhost:4566" | ||
apigatewayv2 = "http://localhost:4566" | ||
cloudformation = "http://localhost:4566" | ||
cloudwatch = "http://localhost:4566" | ||
dynamodb = "http://localhost:4566" | ||
ec2 = "http://localhost:4566" | ||
es = "http://localhost:4566" | ||
elasticache = "http://localhost:4566" | ||
firehose = "http://localhost:4566" | ||
iam = "http://localhost:4566" | ||
kinesis = "http://localhost:4566" | ||
lambda = "http://localhost:4566" | ||
rds = "http://localhost:4566" | ||
redshift = "http://localhost:4566" | ||
route53 = "http://localhost:4566" | ||
s3 = "http://localhost:4566" | ||
secretsmanager = "http://localhost:4566" | ||
ses = "http://localhost:4566" | ||
sns = "http://localhost:4566" | ||
sqs = "http://localhost:4566" | ||
ssm = "http://localhost:4566" | ||
stepfunctions = "http://localhost:4566" | ||
sts = "http://localhost:4566" | ||
} | ||
} | ||
|
||
resource "random_string" "random_localstack" { | ||
length = 6 | ||
special = false | ||
upper = false | ||
} | ||
|
||
resource "aws_s3_bucket" "filebeat-integtest-localstack" { | ||
provider = aws.localstack | ||
bucket = "filebeat-s3-integtest-localstack-${random_string.random_localstack.result}" | ||
force_destroy = true | ||
} | ||
|
||
resource "aws_sqs_queue" "filebeat-integtest-localstack" { | ||
provider = aws.localstack | ||
name = "filebeat-sqs-integtest-localstack-${random_string.random_localstack.result}" | ||
policy = <<POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Id": "sqspolicy", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": "sqs:SendMessage", | ||
"Resource": "arn:aws:sqs:*:*:filebeat-sqs-integtest-localstack-${random_string.random_localstack.result}", | ||
"Condition": { | ||
"ArnEquals": { "aws:SourceArn": "${aws_s3_bucket.filebeat-integtest-localstack.arn}" } | ||
} | ||
} | ||
] | ||
} | ||
POLICY | ||
|
||
depends_on = [ | ||
aws_s3_bucket.filebeat-integtest-localstack, | ||
] | ||
} | ||
|
||
resource "aws_s3_bucket_notification" "bucket_notification-localstack" { | ||
provider = aws.localstack | ||
bucket = aws_s3_bucket.filebeat-integtest-localstack.id | ||
|
||
queue { | ||
queue_arn = aws_sqs_queue.filebeat-integtest-localstack.arn | ||
events = ["s3:ObjectCreated:*"] | ||
} | ||
|
||
depends_on = [ | ||
aws_s3_bucket.filebeat-integtest-localstack, | ||
aws_sqs_queue.filebeat-integtest-localstack, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.