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

Test preconfigured agent policies and output #1680

Merged
merged 10 commits into from
Oct 21, 2021
9 changes: 7 additions & 2 deletions e2e/_suites/fleet/features/preconfigured_policies.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ Feature: Preconfigured Policies

Scenario Outline: Enrolling an agent in a preconfigured policy
Given kibana uses "preconfigured-policies" profile
And agent uses "Test preconfigured policy" policy
And agent uses enrollment token from "Test preconfigured policy" policy
And a "<os>" agent is deployed to Fleet with "tar" installer
When the "elastic-agent" process is in the "started" state on the host
Then the agent is listed in Fleet as "online"
And the agent run the "Test preconfigured policy" policy
And the agent is enrolled into "Test preconfigured policy" policy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this step name! 😄



@debian
Examples: Debian
nchaulet marked this conversation as resolved.
Show resolved Hide resolved
| os |
| debian |

@centos
Examples: Centos
| os |
| centos |
nchaulet marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 7 additions & 6 deletions e2e/_suites/fleet/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ type FleetTestSuite struct {

// afterScenario destroys the state created by a scenario
func (fts *FleetTestSuite) afterScenario() {
defer func() { deployedAgentsCount = 0 }()

// Reset Kibana Profile to default
fts.KibanaProfile = ""
defer func() {
// Reset Kibana Profile to default
fts.KibanaProfile = ""
deployedAgentsCount = 0
}()

span := tx.StartSpan("Clean up", "test.scenario.clean", nil)
fts.currentContext = apm.ContextWithSpan(context.Background(), span)
Expand Down Expand Up @@ -153,7 +154,7 @@ func (fts *FleetTestSuite) beforeScenario() {

func (fts *FleetTestSuite) contributeSteps(s *godog.ScenarioContext) {
s.Step(`^kibana uses "([^"]*)" profile$`, fts.kibanaUsesProfile)
s.Step(`^agent uses "([^"]*)" policy$`, fts.agentUsesPolicy)
s.Step(`^agent uses enrollment token from "([^"]*)" policy$`, fts.agentUsesPolicy)
s.Step(`^a "([^"]*)" agent is deployed to Fleet$`, fts.anAgentIsDeployedToFleet)
s.Step(`^a "([^"]*)" agent is deployed to Fleet on top of "([^"]*)"$`, fts.anAgentIsDeployedToFleetOnTopOfBeat)
s.Step(`^a "([^"]*)" agent is deployed to Fleet with "([^"]*)" installer$`, fts.anAgentIsDeployedToFleetWithInstaller)
Expand All @@ -171,7 +172,7 @@ func (fts *FleetTestSuite) contributeSteps(s *godog.ScenarioContext) {
s.Step(`^the file system Agent folder is empty$`, fts.theFileSystemAgentFolderIsEmpty)
s.Step(`^certs are installed$`, fts.installCerts)
s.Step(`^a Linux data stream exists with some data$`, fts.checkDataStream)
s.Step(`^the agent run the "([^"]*)" policy$`, fts.agentRunPolicy)
s.Step(`^the agent is enrolled into "([^"]*)" policy$`, fts.agentRunPolicy)

// endpoint steps
s.Step(`^the "([^"]*)" integration is "([^"]*)" in the policy$`, fts.theIntegrationIsOperatedInThePolicy)
Expand Down