Skip to content

Commit

Permalink
Move integration test to ess staging (#3535) (#3540)
Browse files Browse the repository at this point in the history
* move default ESS env to staging for integration tests

(cherry picked from commit 160b034)

Co-authored-by: Paolo Chilà <[email protected]>
  • Loading branch information
mergify[bot] and pchila authored Oct 6, 2023
1 parent b075253 commit a5cd5af
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ DOCKER_REGISTRY="docker.elastic.co"
DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"
CI_GCP_OBS_PATH="kv/ci-shared/observability-ingest/cloud/gcp"
CI_AGENT_QA_OBS_PATH="kv/ci-shared/observability-ingest/elastic-agent-ess-qa"
# CI_AGENT_QA_OBS_PATH="kv/ci-shared/observability-ingest/elastic-agent-ess-qa"
CI_ESS_STAGING_PATH="kv/ci-shared/platform-ingest/platform-ingest-ec-staging"
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"


Expand Down Expand Up @@ -54,7 +55,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent" && "$BUILDKITE_STEP_KEY" ==
export TEST_INTEG_AUTH_GCP_SERVICE_TOKEN_FILE=$(realpath ./gcp.json)

# ESS credentials
export API_KEY_TOKEN=$(vault kv get -field api_key ${CI_AGENT_QA_OBS_PATH})
export API_KEY_TOKEN=$(vault kv get -field apiKey ${CI_ESS_STAGING_PATH})
echo ${API_KEY_TOKEN} > ./apiKey
export TEST_INTEG_AUTH_ESS_APIKEY_FILE=$(realpath ./apiKey)
fi
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AGENT_PACKAGE_VERSION="${OVERRIDE_AGENT_PACKAGE_VERSION}" DEV=true EXTERNAL=true

# Run integration tests
set +e
AGENT_VERSION="${OVERRIDE_TEST_AGENT_VERSION}" TEST_INTEG_AUTH_ESS_REGION=azure-eastus2 TEST_INTEG_CLEAN_ON_EXIT=true SNAPSHOT=true mage integration:test
AGENT_VERSION="${OVERRIDE_TEST_AGENT_VERSION}" TEST_INTEG_CLEAN_ON_EXIT=true SNAPSHOT=true mage integration:test
TESTS_EXIT_STATUS=$?
set -e

Expand Down
4 changes: 2 additions & 2 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2094,8 +2094,8 @@ func authESS(ctx context.Context) error {

fmt.Fprintln(os.Stderr, "❌ ESS authentication unsuccessful. Retrying...")

prompt := "Please provide a ESS (QA) API key. To get your API key, " +
"visit https://console.qa.cld.elstc.co/deployment-features/keys:"
prompt := fmt.Sprintf("Please provide a ESS API key for %s. To get your API key, "+
"visit %s/deployment-features/keys:", client.BaseURL(), strings.TrimRight(client.BaseURL(), "/api/v1"))
essAPIKey, err = stringPrompt(prompt)
if err != nil {
return fmt.Errorf("unable to read ESS API key from prompt: %w", err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/testing/ess/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ func (c *Client) doPost(ctx context.Context, relativeUrl, contentType string, bo

return c.client.Do(req)
}

func (c *Client) BaseURL() string {
return c.config.BaseUrl
}
2 changes: 1 addition & 1 deletion pkg/testing/ess/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Config struct {

func defaultConfig() *Config {
return &Config{
BaseUrl: `https://console.qa.cld.elstc.co/api/v1`,
BaseUrl: `https://staging.found.no/api/v1`,
}
}

Expand Down

0 comments on commit a5cd5af

Please sign in to comment.