Skip to content

Commit

Permalink
[Buildkite][Integration tests] Change ESS region to aws-eu-central-1 (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
ycombinator authored Nov 1, 2023
1 parent 2a93086 commit 33a6d10
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .buildkite/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-**"
Expand All @@ -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-**"
Expand Down
4 changes: 3 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 12 additions & 5 deletions pkg/testing/ess/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 33a6d10

Please sign in to comment.