Skip to content

Commit

Permalink
Merge branch 'master' into 901-support-kibana-prs
Browse files Browse the repository at this point in the history
* master:
  Remove the agent config file parameters for stand alone (elastic#983)
  Uniquify the stand-alone step for checking agent status (elastic#993)
  • Loading branch information
mdelapenya committed Apr 12, 2021
2 parents 72c1c37 + 9aeb82c commit 7e6af36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
2 changes: 0 additions & 2 deletions cli/config/compose/services/elastic-agent/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ services:
platform: ${elasticAgentPlatform:-linux/amd64}
ports:
- "127.0.0.1:8220:8220"
volumes:
- "${elasticAgentConfigFile}:/usr/share/elastic-agent/elastic-agent.yml"
2 changes: 1 addition & 1 deletion e2e/_suites/fleet/features/stand_alone_agent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Examples: Ubi8
@run_fleet_server
Scenario Outline: Deploying a <image> stand-alone agent with fleet server mode
When a "<image>" stand-alone agent is deployed with fleet server mode
Then the agent is listed in Fleet as "online"
Then the stand-alone agent is listed in Fleet as "online"

@default
Examples: default
Expand Down
35 changes: 5 additions & 30 deletions e2e/_suites/fleet/stand-alone.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main
import (
"context"
"fmt"
"os"
"strings"
"time"

Expand All @@ -22,10 +21,9 @@ import (

// StandAloneTestSuite represents the scenarios for Stand-alone-mode
type StandAloneTestSuite struct {
AgentConfigFilePath string
Cleanup bool
Hostname string
Image string
Cleanup bool
Hostname string
Image string
// date controls for queries
AgentStoppedDate time.Time
RuntimeDependenciesStartDate time.Time
Expand All @@ -45,21 +43,6 @@ func (sats *StandAloneTestSuite) afterScenario() {
} else {
log.WithField("service", serviceName).Info("Because we are running in development mode, the service won't be stopped")
}

if _, err := os.Stat(sats.AgentConfigFilePath); err == nil {
beatsLocalPath := shell.GetEnv("BEATS_LOCAL_PATH", "")
if beatsLocalPath == "" {
os.Remove(sats.AgentConfigFilePath)

log.WithFields(log.Fields{
"path": sats.AgentConfigFilePath,
}).Trace("Elastic Agent configuration file removed.")
} else {
log.WithFields(log.Fields{
"path": sats.AgentConfigFilePath,
}).Trace("Elastic Agent configuration file not removed because it's part of a repository.")
}
}
}

func (sats *StandAloneTestSuite) contributeSteps(s *godog.ScenarioContext) {
Expand All @@ -68,7 +51,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 agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus)
s.Step(`^the stand-alone agent is listed in Fleet as "([^"]*)"$`, sats.theAgentIsListedInFleetWithStatus)
}

func (sats *StandAloneTestSuite) theAgentIsListedInFleetWithStatus(desiredStatus string) error {
Expand Down Expand Up @@ -102,11 +85,6 @@ func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string)
dockerImageTag += "-amd64"
}

configurationFilePath, err := steps.FetchBeatConfiguration(true, "elastic-agent", "elastic-agent.docker.yml")
if err != nil {
return err
}

serviceManager := services.NewServiceManager()

profileEnv["elasticAgentDockerImageSuffix"] = ""
Expand All @@ -118,18 +96,15 @@ func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string)

containerName := fmt.Sprintf("%s_%s_%d", FleetProfileName, ElasticAgentServiceName, 1)

sats.AgentConfigFilePath = configurationFilePath

profileEnv["elasticAgentContainerName"] = containerName
profileEnv["elasticAgentConfigFile"] = sats.AgentConfigFilePath
profileEnv["elasticAgentPlatform"] = "linux/amd64"
profileEnv["elasticAgentTag"] = dockerImageTag

for k, v := range env {
profileEnv[k] = v
}

err = serviceManager.AddServicesToCompose(context.Background(), FleetProfileName, []string{ElasticAgentServiceName}, profileEnv)
err := serviceManager.AddServicesToCompose(context.Background(), FleetProfileName, []string{ElasticAgentServiceName}, profileEnv)
if err != nil {
log.Error("Could not deploy the elastic-agent")
return err
Expand Down

0 comments on commit 7e6af36

Please sign in to comment.