Skip to content

Commit

Permalink
[Filebeat] Integration tests in CI for AWS-S3 input (#27491)
Browse files Browse the repository at this point in the history
* [Filebeat] Integration tests in CI for AWS-S3 input
  • Loading branch information
Andrea Spacca authored Sep 6, 2021
1 parent 20be506 commit 9d4597a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
RUNBLD_DISABLE_NOTIFICATIONS = 'true'
SLACK_CHANNEL = "#beats-build"
SNAPSHOT = 'true'
TERRAFORM_VERSION = "0.12.30"
TERRAFORM_VERSION = "0.13.7"
XPACK_MODULE_PATTERN = '^x-pack\\/[a-z0-9]+beat\\/module\\/([^\\/]+)\\/.*'
}
options {
Expand Down Expand Up @@ -840,8 +840,10 @@ def withCloudTestEnv(Closure body) {
def maskedVars = []
def testTags = "${env.TEST_TAGS}"

// AWS
if (params.allCloudTests || params.awsCloudTests) {
// Allow AWS credentials when the build was configured to do so with:
// - the cloudtests build parameters
// - the aws github label
if (params.allCloudTests || params.awsCloudTests || matchesPrLabel(label: 'aws')) {
testTags = "${testTags},aws"
def aws = getVaultSecret(secret: "${AWS_ACCOUNT_SECRET}").data
if (!aws.containsKey('access_key')) {
Expand Down Expand Up @@ -893,6 +895,7 @@ def startCloudTestEnv(Map args = [:]) {
// If it failed then cleanup without failing the build
sh(label: 'Terraform Cleanup', script: ".ci/scripts/terraform-cleanup.sh ${folder}", returnStatus: true)
}
error('startCloudTestEnv: terraform apply failed.')
} finally {
// Archive terraform states in case manual cleanup is needed.
archiveArtifacts(allowEmptyArchive: true, artifacts: '**/terraform.tfstate')
Expand Down
13 changes: 13 additions & 0 deletions x-pack/filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ stages:
platforms: ## override default labels in this specific stage.
- "windows-7"
stage: extended
cloud:
cloud: "mage build test"
withModule: true ## run the ITs only if the changeset affects a specific module.
dirs: ## apply terraform for the given directory.
- "x-pack/filebeat/input/awss3/_meta/terraform"
when: ## Override the top-level when.
parameters:
- "awsCloudTests"
comments:
- "/test x-pack/filebeat for aws cloud"
labels:
- "aws"
stage: extended
#windows-7-32: See https://github.com/elastic/beats/issues/22315
# mage: "mage build unitTest"
# platforms: ## override default labels in this specific stage.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/aws/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "aws_s3_bucket_object" "test" {
resource "aws_instance" "test" {
ami = data.aws_ami.latest-amzn.id
monitoring = true
instance_type = "t1.micro"
instance_type = "t2.micro"
tags = {
Name = "metricbeat-test"
}
Expand Down

0 comments on commit 9d4597a

Please sign in to comment.