From a442410b4efeeb16b5b008d048e444e0a13c3028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 8 Apr 2021 12:32:24 +0200 Subject: [PATCH 1/2] Revert "Uniquify the stand-alone step for checking agent status (#993) (#996)" This reverts commit 9818d674516cb601add1dd07f568926e6584ce73. --- e2e/_suites/fleet/features/stand_alone_agent.feature | 2 +- e2e/_suites/fleet/stand-alone.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/_suites/fleet/features/stand_alone_agent.feature b/e2e/_suites/fleet/features/stand_alone_agent.feature index 78af314844..af05676a92 100644 --- a/e2e/_suites/fleet/features/stand_alone_agent.feature +++ b/e2e/_suites/fleet/features/stand_alone_agent.feature @@ -54,7 +54,7 @@ Examples: Ubi8 @run_fleet_server Scenario Outline: Deploying a stand-alone agent with fleet server mode When a "" stand-alone agent is deployed with fleet server mode - Then the stand-alone agent is listed in Fleet as "online" + Then the agent is listed in Fleet as "online" @default Examples: default diff --git a/e2e/_suites/fleet/stand-alone.go b/e2e/_suites/fleet/stand-alone.go index 4f6ea68f89..9f219ee323 100644 --- a/e2e/_suites/fleet/stand-alone.go +++ b/e2e/_suites/fleet/stand-alone.go @@ -68,7 +68,7 @@ func (sats *StandAloneTestSuite) contributeSteps(s *godog.ScenarioContext) { s.Step(`^there is new data in the index from agent$`, sats.thereIsNewDataInTheIndexFromAgent) s.Step(`^the "([^"]*)" docker container is stopped$`, sats.theDockerContainerIsStopped) s.Step(`^there is no new data in the index after agent shuts down$`, sats.thereIsNoNewDataInTheIndexAfterAgentShutsDown) - s.Step(`^the stand-alone agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus) + s.Step(`^the agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus) } func (sats *StandAloneTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus string) error { From 770b64e30e92b7e161f3f1062a6b5ca29f0c395f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 8 Apr 2021 12:32:30 +0200 Subject: [PATCH 2/2] Revert "Add a standalone test scenario for fleet server mode (#978) (#987)" This reverts commit a42c0ce625175351cd76c3439337f5f131de9ba3. --- .../services/elastic-agent/docker-compose.yml | 8 -------- .../fleet/features/stand_alone_agent.feature | 10 ---------- e2e/_suites/fleet/fleet.go | 12 ++++-------- e2e/_suites/fleet/stand-alone.go | 19 ------------------- 4 files changed, 4 insertions(+), 45 deletions(-) diff --git a/cli/config/compose/services/elastic-agent/docker-compose.yml b/cli/config/compose/services/elastic-agent/docker-compose.yml index 471df73b48..6ffb88e44a 100644 --- a/cli/config/compose/services/elastic-agent/docker-compose.yml +++ b/cli/config/compose/services/elastic-agent/docker-compose.yml @@ -10,14 +10,6 @@ services: condition: service_healthy environment: - "KIBANA_HOST=http://${kibanaHost:-kibana}:${kibanaPort:-5601}" - - "FLEET_SERVER_ENABLE=${fleetServerMode:-0}" - - "FLEET_SERVER_INSECURE_HTTP=${fleetServerMode:-0}" - - "KIBANA_FLEET_SETUP=${fleetServerMode:-0}" - - "FLEET_SERVER_HOST=0.0.0.0" - - "KIBANA_USERNAME=elastic" - - "KIBANA_PASSWORD=changeme" platform: ${elasticAgentPlatform:-linux/amd64} - ports: - - "127.0.0.1:8220:8220" volumes: - "${elasticAgentConfigFile}:/usr/share/elastic-agent/elastic-agent.yml" diff --git a/e2e/_suites/fleet/features/stand_alone_agent.feature b/e2e/_suites/fleet/features/stand_alone_agent.feature index af05676a92..5842cd57cb 100644 --- a/e2e/_suites/fleet/features/stand_alone_agent.feature +++ b/e2e/_suites/fleet/features/stand_alone_agent.feature @@ -50,13 +50,3 @@ Examples: default Examples: Ubi8 | image | | ubi8 | - -@run_fleet_server -Scenario Outline: Deploying a stand-alone agent with fleet server mode - When a "" stand-alone agent is deployed with fleet server mode - Then the agent is listed in Fleet as "online" - -@default -Examples: default - | image | - | default | diff --git a/e2e/_suites/fleet/fleet.go b/e2e/_suites/fleet/fleet.go index 7e00ea1b8d..bd70717ae7 100644 --- a/e2e/_suites/fleet/fleet.go +++ b/e2e/_suites/fleet/fleet.go @@ -406,10 +406,6 @@ func (fts *FleetTestSuite) setup() error { } func (fts *FleetTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus string) error { - return theAgentIsListedInFleetWithStatus(desiredStatus, fts.Hostname) -} - -func theAgentIsListedInFleetWithStatus(desiredStatus, hostname string) error { log.Tracef("Checking if agent is listed in Fleet as %s", desiredStatus) maxTimeout := time.Duration(timeoutFactor) * time.Minute * 2 @@ -418,7 +414,7 @@ func theAgentIsListedInFleetWithStatus(desiredStatus, hostname string) error { exp := e2e.GetExponentialBackOff(maxTimeout) agentOnlineFn := func() error { - agentID, err := getAgentID(hostname) + agentID, err := getAgentID(fts.Hostname) if err != nil { retryCount++ return err @@ -429,7 +425,7 @@ func theAgentIsListedInFleetWithStatus(desiredStatus, hostname string) error { if desiredStatus == "offline" || desiredStatus == "inactive" { log.WithFields(log.Fields{ "elapsedTime": exp.GetElapsedTime(), - "hostname": hostname, + "hostname": fts.Hostname, "retries": retryCount, "status": desiredStatus, }).Info("The Agent is not present in Fleet, as expected") @@ -450,7 +446,7 @@ func theAgentIsListedInFleetWithStatus(desiredStatus, hostname string) error { "agentID": agentID, "isAgentInStatus": isAgentInStatus, "elapsedTime": exp.GetElapsedTime(), - "hostname": hostname, + "hostname": fts.Hostname, "retry": retryCount, "status": desiredStatus, }).Warn(err.Error()) @@ -463,7 +459,7 @@ func theAgentIsListedInFleetWithStatus(desiredStatus, hostname string) error { log.WithFields(log.Fields{ "isAgentInStatus": isAgentInStatus, "elapsedTime": exp.GetElapsedTime(), - "hostname": hostname, + "hostname": fts.Hostname, "retries": retryCount, "status": desiredStatus, }).Info("The Agent is in the desired status") diff --git a/e2e/_suites/fleet/stand-alone.go b/e2e/_suites/fleet/stand-alone.go index 9f219ee323..0915df4c2d 100644 --- a/e2e/_suites/fleet/stand-alone.go +++ b/e2e/_suites/fleet/stand-alone.go @@ -64,27 +64,12 @@ func (sats *StandAloneTestSuite) afterScenario() { func (sats *StandAloneTestSuite) contributeSteps(s *godog.ScenarioContext) { s.Step(`^a "([^"]*)" stand-alone agent is deployed$`, sats.aStandaloneAgentIsDeployed) - s.Step(`^a "([^"]*)" stand-alone agent is deployed with fleet server mode$`, sats.aStandaloneAgentIsDeployedWithFleetServerMode) s.Step(`^there is new data in the index from agent$`, sats.thereIsNewDataInTheIndexFromAgent) s.Step(`^the "([^"]*)" docker container is stopped$`, sats.theDockerContainerIsStopped) s.Step(`^there is no new data in the index after agent shuts down$`, sats.thereIsNoNewDataInTheIndexAfterAgentShutsDown) - s.Step(`^the agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus) -} - -func (sats *StandAloneTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus string) error { - return theAgentIsListedInFleetWithStatus(desiredStatus, sats.Hostname) -} - -func (sats *StandAloneTestSuite) aStandaloneAgentIsDeployedWithFleetServerMode(image string) error { - return sats.startAgent(image, map[string]string{"fleetServerMode": "1"}) } func (sats *StandAloneTestSuite) aStandaloneAgentIsDeployed(image string) error { - return sats.startAgent(image, nil) -} - -func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string) error { - log.Trace("Deploying an agent to Fleet") dockerImageTag := agentVersion @@ -125,10 +110,6 @@ func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string) profileEnv["elasticAgentPlatform"] = "linux/amd64" profileEnv["elasticAgentTag"] = dockerImageTag - for k, v := range env { - profileEnv[k] = v - } - err = serviceManager.AddServicesToCompose(context.Background(), FleetProfileName, []string{ElasticAgentServiceName}, profileEnv) if err != nil { log.Error("Could not deploy the elastic-agent")