Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cloude2e tests #3120

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
DOCKER_IMAGE_LATEST_TAG: "latest" # needs to rename for rollback
DOCKER_IMAGE_GIT_TAG: "${BUILDKITE_BRANCH}" # needs to rename for rollback
GO_AGENT_IMAGE: "golang:${GO_VERSION}"
TERRAFORM_VERSION: "1.6.3"
TERRAFORM_VERSION: "1.6.4"

steps:
- group: "Check and build"
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ test-e2e: docker-cover-e2e-binaries build-e2e-agent-image e2e-certs build-docker

.PHONY: test-e2e-set
test-e2e-set: ## - Run the blackbox end to end tests without setup.
cd testing; \
cd testing/e2e; \
ELASTICSEARCH_SERVICE_TOKEN=$(shell ./dev-tools/integration/get-elasticsearch-servicetoken.sh ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}@${TEST_ELASTICSEARCH_HOSTS} "fleet-server") \
ELASTICSEARCH_HOSTS=${TEST_ELASTICSEARCH_HOSTS} ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME} ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD} \
AGENT_E2E_IMAGE=$(shell cat "build/e2e-image") \
Expand All @@ -393,6 +393,6 @@ test-cloude2e: prepare-test-context ## - Run cloude2e tests with full setup (sl

.PHONY: test-cloude2e-set
test-cloude2e-set: ## Run cloude2e test
$(eval FLEET_SERVER_URL := $(shell make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url))
make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url
FLEET_SERVER_URL=${FLEET_SERVER_URL} go test -v -tags=cloude2e -count=1 -race -p 1 ./testing/cloude2e
cd testing/cloude2e; \
FLEET_SERVER_URL=$(shell terraform output --state=dev-tools/cloud/terraform/terraform.tfstate fleet_url) \
go test -v -tags=cloude2e -count=1 -race -p 1 ./...
14 changes: 9 additions & 5 deletions dev-tools/cloud/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
ec = {
source = "elastic/ec"
version = "0.5.1"
version = "0.9.0"
}
}
}
Expand Down Expand Up @@ -58,12 +58,16 @@ resource "ec_deployment" "deployment" {
"creator" = var.creator
}

elasticsearch {}
elasticsearch = {
hot = {
autoscaling = {}
}
}

kibana {}
kibana = {}

integrations_server {
config {
integrations_server = {
config = {
docker_image = local.docker_image_ea
}
}
Expand Down
7 changes: 4 additions & 3 deletions dev-tools/cloud/terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ output "elasticsearch_password" {
}

output "elasticsearch_url" {
value = ec_deployment.deployment.elasticsearch.0.https_endpoint
value = ec_deployment.deployment.elasticsearch.https_endpoint
description = "The secure Elasticsearch URL"
}

output "kibana_url" {
value = ec_deployment.deployment.kibana.0.https_endpoint
value = ec_deployment.deployment.kibana.https_endpoint
description = "The secure Kibana URL"
}

# Note that ec_deployment.deployment.integrations_server.endpoints.fleet may not be populated
output "fleet_url" {
value = ec_deployment.deployment.integrations_server.0.fleet_https_endpoint
value = replace(ec_deployment.deployment.integrations_server.https_endpoint, ".apm.", ".fleet.")
description = "The secure Fleet URL"
}
15 changes: 14 additions & 1 deletion testing/cloude2e/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ func (suite *TestSuite) TestFleetServerStatusOK() {
req, err := http.NewRequestWithContext(ctx, "GET", suite.fleetServerURL+"/api/status", nil)
suite.Require().NoError(err)

resp, err := suite.client.Do(req)
var resp *http.Response
for ctx.Err() == nil {
resp, err = suite.client.Do(req)
if err != nil {
suite.T().Logf("Request error: %v", err)
}
if resp != nil {
if resp.StatusCode == http.StatusOK {
break
}
suite.T().Logf("Response status: %d", resp.StatusCode)
}
time.Sleep(time.Second)
}
suite.Require().NoError(err)
suite.Require().Equal(http.StatusOK, resp.StatusCode)

Expand Down
Loading