Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions e2e/_suites/fleet/features/backend_processes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Feature: Backend Processes
Scenario Outline: Deploying the <os> agent
Given 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 "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
Then there are "2" instances of the "filebeat" process in the "started" state
And there are "2" instances of the "metricbeat" process in the "started" state

@centos
Examples: Centos
Expand All @@ -23,8 +23,8 @@ Examples: Debian
Scenario Outline: Deploying the <os> agent with enroll and then run on rpm and deb
Given a "<os>" agent is deployed to Fleet with "systemd" installer
When the "elastic-agent" process is in the "started" state on the host
Then the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
Then there are "2" instances of the "filebeat" process in the "started" state
And there are "2" instances of the "metricbeat" process in the "started" state

@centos
Examples: Centos
Expand Down Expand Up @@ -57,8 +57,8 @@ Examples: Debian
Scenario Outline: Restarting the installed <os> agent
Given a "<os>" agent is deployed to Fleet with "tar" installer
When the "elastic-agent" process is "restarted" on the host
Then the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
Then there are "2" instances of the "filebeat" process in the "started" state
And there are "2" instances of the "metricbeat" process in the "started" state

@centos
Examples: Centos
Expand All @@ -75,8 +75,8 @@ Scenario Outline: Restarting the <os> host with persistent agent restarts backen
Given a "<os>" agent is deployed to Fleet with "tar" installer
When the host is restarted
Then the "elastic-agent" process is in the "started" state on the host
And the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
And there are "2" instances of the "filebeat" process in the "started" state
And there are "2" instances of the "metricbeat" process in the "started" state

@centos
Examples: Centos
Expand Down
4 changes: 2 additions & 2 deletions e2e/_suites/fleet/features/stand_alone_agent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Feature: Stand-alone Agent
@start-agent
Scenario Outline: Starting the <image> agent starts backend processes
When a "<image>" stand-alone agent is deployed
Then the "filebeat" process is in the "started" state on the host
And the "metricbeat" process is in the "started" state on the host
Then there are "1" instances of the "filebeat" process in the "started" state
And there are "2" instances of the "metricbeat" process in the "started" state

@default
Examples: default
Expand Down
4 changes: 2 additions & 2 deletions e2e/_suites/fleet/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (fts *FleetTestSuite) processStateChangedOnTheHost(process string, state st

containerName := fts.getContainerName(agentInstaller, 1)

return docker.CheckProcessStateOnTheHost(containerName, process, "stopped", common.TimeoutFactor)
return docker.CheckProcessStateOnTheHost(containerName, process, "stopped", 1, common.TimeoutFactor)
}

func (fts *FleetTestSuite) setup() error {
Expand Down Expand Up @@ -543,7 +543,7 @@ func (fts *FleetTestSuite) theFileSystemAgentFolderIsEmpty() error {
return err
}

if strings.Contains(content, "No such file or directory") {
if content == "" || strings.Contains(content, "No such file or directory") {
return nil
}

Expand Down
1 change: 1 addition & 0 deletions e2e/_suites/fleet/ingest_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func InitializeIngestManagerTestScenario(ctx *godog.ScenarioContext) {
})

ctx.Step(`^the "([^"]*)" process is in the "([^"]*)" state on the host$`, imts.processStateOnTheHost)
ctx.Step(`^there are "([^"]*)" instances of the "([^"]*)" process in the "([^"]*)" state$`, imts.thereAreInstancesOfTheProcessInTheState)

imts.Fleet.contributeSteps(ctx)
}
Expand Down
12 changes: 11 additions & 1 deletion e2e/_suites/fleet/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main

import (
"fmt"
"strconv"

"github.com/elastic/e2e-testing/internal/common"
"github.com/elastic/e2e-testing/internal/docker"
Expand All @@ -17,6 +18,10 @@ type IngestManagerTestSuite struct {
}

func (imts *IngestManagerTestSuite) processStateOnTheHost(process string, state string) error {
return imts.thereAreInstancesOfTheProcessInTheState("1", process, state)
}

func (imts *IngestManagerTestSuite) thereAreInstancesOfTheProcessInTheState(ocurrences string, process string, state string) error {
profile := common.FleetProfileName

var containerName string
Expand All @@ -28,5 +33,10 @@ func (imts *IngestManagerTestSuite) processStateOnTheHost(process string, state
containerName = imts.Fleet.getContainerName(agentInstaller, 1)
}

return docker.CheckProcessStateOnTheHost(containerName, process, state, common.TimeoutFactor)
count, err := strconv.Atoi(ocurrences)
if err != nil {
return err
}

return docker.CheckProcessStateOnTheHost(containerName, process, state, count, common.TimeoutFactor)
}
Loading