From 33a6d10e4625dbc1e3828f2be38f48251c095bd5 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 2 Nov 2023 00:07:47 +0530 Subject: [PATCH] [Buildkite][Integration tests] Change ESS region to `aws-eu-central-1` (#3681) * Switch ESS region to aws-eu-central-1 for integration tests * Implement special case for AWS us-east-1 region * Switch to us-east-1 --- .buildkite/hooks/pre-exit | 2 +- .buildkite/pipeline.yml | 4 ++++ magefile.go | 4 +++- pkg/testing/ess/deployment.go | 17 ++++++++++++----- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit index c6747e4023f..4d0da50cf73 100755 --- a/.buildkite/hooks/pre-exit +++ b/.buildkite/hooks/pre-exit @@ -10,7 +10,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent" && "$BUILDKITE_STEP_KEY" == # Perform cleanup of integration tests resources echo "--- Cleaning up integration test resources" - TEST_INTEG_AUTH_ESS_REGION=azure-eastus2 SNAPSHOT=true mage integration:clean + TEST_INTEG_AUTH_ESS_REGION=us-east-1 SNAPSHOT=true mage integration:clean fi if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ]; then diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2ae836321ce..0f114dcaa4a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -138,6 +138,8 @@ steps: - label: "Serverless integration test" key: "serverless-integration-tests" + env: + TEST_INTEG_AUTH_ESS_REGION: us-east-1 command: ".buildkite/scripts/steps/integration_tests.sh serverless integration:single TestMonitoringLogsShipped" #right now, run a single test in serverless mode as a sort of smoke test, instead of re-running the entire suite artifact_paths: - "build/TEST-**" @@ -148,6 +150,8 @@ steps: - label: "Integration tests" key: "integration-tests" + env: + TEST_INTEG_AUTH_ESS_REGION: us-east-1 command: ".buildkite/scripts/steps/integration_tests.sh stateful" artifact_paths: - "build/TEST-**" diff --git a/magefile.go b/magefile.go index f445ad22c7e..23394850ee3 100644 --- a/magefile.go +++ b/magefile.go @@ -1755,7 +1755,9 @@ func createTestRunner(matrix bool, singleTest string, goTestFlags string, batche datacenter = "us-central1-a" } - // Valid values are gcp-us-central1 (default), azure-eastus2 + // Valid values are gcp-us-central1 (default), azure-eastus2, + // aws-eu-central-1, us-east-1 (which is an AWS region but the + // "aws" CSP prefix is not used by ESS for some reason!) essRegion := os.Getenv("TEST_INTEG_AUTH_ESS_REGION") if essRegion == "" { essRegion = "gcp-us-central1" diff --git a/pkg/testing/ess/deployment.go b/pkg/testing/ess/deployment.go index 882e9211704..cbb15e40f5e 100644 --- a/pkg/testing/ess/deployment.go +++ b/pkg/testing/ess/deployment.go @@ -321,12 +321,19 @@ var createDeploymentRequestTemplate string var cloudProviderSpecificValues []byte func generateCreateDeploymentRequestBody(req CreateDeploymentRequest) ([]byte, error) { - regionParts := strings.Split(req.Region, "-") - if len(regionParts) < 2 { - return nil, fmt.Errorf("unable to parse CSP out of region [%s]", req.Region) - } + var csp string + // Special case: AWS us-east-1 region is just called + // us-east-1 (instead of aws-us-east-1)! + if req.Region == "us-east-1" { + csp = "aws" + } else { + regionParts := strings.Split(req.Region, "-") + if len(regionParts) < 2 { + return nil, fmt.Errorf("unable to parse CSP out of region [%s]", req.Region) + } - csp := regionParts[0] + csp = regionParts[0] + } templateContext, err := createDeploymentTemplateContext(csp, req) if err != nil { return nil, fmt.Errorf("creating request template context: %w", err)