Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
simplify some things
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvz committed May 4, 2021
1 parent 5c9a7de commit 45340b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
4 changes: 2 additions & 2 deletions e2e/_suites/fleet/features/apm_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Scenarios for APM
Scenario Outline: Deploying a <image> stand-alone agent with fleet server mode
Given a "<image>" stand-alone agent is deployed with fleet server mode
And the stand-alone agent is listed in Fleet as "online"
When the "Elastic APM" integration is added to the policy
Then the "Elastic APM" datasource is shown in the policy
When the "Elastic APM" integration is added in the policy
Then the "Elastic APM" datasource is shown in the policy as added
And the "apm-server" process is in the "started" state on the host


Expand Down
2 changes: 0 additions & 2 deletions e2e/_suites/fleet/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ func (fts *FleetTestSuite) contributeSteps(s *godog.ScenarioContext) {
s.Step(`^the "([^"]*)" docker container is stopped$`, fts.theDockerContainerIsStopped)
s.Step(`^there is no new data in the index after agent shuts down$`, fts.thereIsNoNewDataInTheIndexAfterAgentShutsDown)
s.Step(`^the stand-alone agent is listed in Fleet as "([^"]*)"$`, fts.theStandaloneAgentIsListedInFleetWithStatus)
s.Step(`^the "([^"]*)" integration is added to the policy$`, fts.theIntegrationIsAddedToThePolicy)
s.Step(`^the "([^"]*)" datasource is shown in the policy$`, fts.thePolicyShowsTheDatasourceAdded)
}

func (fts *FleetTestSuite) theStandaloneAgentIsListedInFleetWithStatus(desiredStatus string) error {
Expand Down
18 changes: 5 additions & 13 deletions e2e/_suites/fleet/stand-alone.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,26 @@ import (
)

func (fts *FleetTestSuite) aStandaloneAgentIsDeployed(image string) error {
fts.StandAlone = true
return fts.startAgent(image, "", nil)
return fts.startStandAloneAgent(image, "", nil)
}

func (fts *FleetTestSuite) bootstrapFleetServerFromAStandaloneAgent(image string) error {
fts.StandAlone = true
fleetPolicy, err := fts.kibanaClient.GetDefaultPolicy(true)
if err != nil {
return err
}
fts.FleetServerPolicy = fleetPolicy
return fts.startAgent(image, "", map[string]string{"fleetServerMode": "1"})
return fts.startStandAloneAgent(image, "", map[string]string{"fleetServerMode": "1"})
}

func (fts *FleetTestSuite) aStandaloneAgentIsDeployedWithFleetServerModeOnCloud(image string) error {
fts.StandAlone = true
fleetPolicy, err := fts.kibanaClient.GetDefaultPolicy(true)
if err != nil {
return err
}
fts.FleetServerPolicy = fleetPolicy
volume := path.Join(config.OpDir(), "compose", "services", "elastic-agent", "apm-legacy")
return fts.startAgent(image, "docker-compose-cloud.yml", map[string]string{"apmVolume": volume})
return fts.startStandAloneAgent(image, "docker-compose-cloud.yml", map[string]string{"apmVolume": volume})
}

func (fts *FleetTestSuite) thereIsNewDataInTheIndexFromAgent() error {
Expand Down Expand Up @@ -94,8 +91,8 @@ func (fts *FleetTestSuite) thereIsNoNewDataInTheIndexAfterAgentShutsDown() error
return elasticsearch.AssertHitsAreNotPresent(result)
}

func (fts *FleetTestSuite) startAgent(image string, composeFilename string, env map[string]string) error {

func (fts *FleetTestSuite) startStandAloneAgent(image string, composeFilename string, env map[string]string) error {
fts.StandAlone = true
log.Trace("Deploying an agent to Fleet")

dockerImageTag := common.AgentVersion
Expand Down Expand Up @@ -156,12 +153,7 @@ func (fts *FleetTestSuite) startAgent(image string, composeFilename string, env
return nil
}

func (fts *FleetTestSuite) theIntegrationIsAddedToThePolicy(packageName string) error {
return theIntegrationIsOperatedInThePolicy(fts.kibanaClient, fts.FleetServerPolicy, packageName, "added")
}

func (fts *FleetTestSuite) thePolicyShowsTheDatasourceAdded(packageName string) error {
fts.StandAlone = true
log.WithFields(log.Fields{
"policyID": fts.FleetServerPolicy.ID,
"package": packageName,
Expand Down

0 comments on commit 45340b1

Please sign in to comment.