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
22 changes: 11 additions & 11 deletions e2e/_suites/fleet/features/system_integration.feature
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,22 @@ Examples: Debian
| os |
| debian |

#@deploy-system_integration-with-filesystem
#Scenario Outline: Adding the System Integration to an Policy
# Given a "<os>" agent is deployed to Fleet with "tar" installer
# And the agent is listed in Fleet as "online"
# When the policy is updated to have "system/metrics" set to "filesystem"
# Then "system/metrics" with "filesystem" metrics are present in the datastreams
#
@deploy-system_integration-with-filesystem
Scenario Outline: Adding the System Integration to an Policy
Given a "<os>" agent is deployed to Fleet with "tar" installer
And the agent is listed in Fleet as "online"
When the policy is updated to have "system/metrics" set to "filesystem"
Then "system/metrics" with "filesystem" metrics are present in the datastreams

#@centos
#Examples: Centos
#| os |
#| centos |

#@debian
#Examples: Debian
#| os |
# | debian |
@debian
Examples: Debian
| os |
| debian |

# @deploy-logfile-for-system-auth
# Scenario Outline: Adding the System Integration to an Policy
Expand Down
25 changes: 21 additions & 4 deletions e2e/_suites/fleet/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,16 @@ func inputs(integration string) []kibana.Input {
return []kibana.Input{}
}

func (fts *FleetTestSuite) getAgentOSData() (string, error) {
agentService := deploy.NewServiceRequest(common.ElasticAgentServiceName)
manifest, _ := fts.deployer.Inspect(fts.currentContext, agentService)
agent, err := fts.kibanaClient.GetAgentByHostname(fts.currentContext, manifest.Hostname)
if err != nil {
return "", err
}
return agent.LocalMetadata.OS.Platform, nil
}

func metricsInputs(integration string, set string) []kibana.Input {
metricsFile := filepath.Join(testResourcesDir, "/metrics.json")
data := readJSONFile(metricsFile, integration, set)
Expand Down Expand Up @@ -1154,6 +1164,7 @@ func (fts *FleetTestSuite) thePolicyIsUpdatedToHaveSystemSet(name string, set st
}).Warn("We only support system system/metrics, log and logfile policy to be updated")
return godog.ErrPending
}
os, _ := fts.getAgentOSData()

packageDS, err := fts.kibanaClient.GetIntegrationFromAgentPolicy(fts.currentContext, "system", fts.Policy)

Expand Down Expand Up @@ -1187,6 +1198,7 @@ func (fts *FleetTestSuite) thePolicyIsUpdatedToHaveSystemSet(name string, set st
"dataset": "system." + set,
"enabled": "true",
"type": "metrics",
"os": os,
}).Info("Policy Updated with package name system." + set)

return nil
Expand All @@ -1197,6 +1209,8 @@ func (fts *FleetTestSuite) theMetricsInTheDataStream(name string, set string) er
timeNow := time.Now()
startTime := timeNow.Unix()

os, _ := fts.getAgentOSData()

waitForDataStreams := func() error {
var exist = false
dataStreams, _ := fts.kibanaClient.GetDataStreams(fts.currentContext)
Expand All @@ -1207,12 +1221,15 @@ func (fts *FleetTestSuite) theMetricsInTheDataStream(name string, set string) er
"dataset": "system." + set,
"enabled": "true",
"type": name,
}).Info("The " + name + "with value system." + set + " in the metrics")
"os": os,
}).Info("The " + name + " with value system." + set + " in the metrics")

if int64(int64(item.Path("last_activity_ms").Data().(float64))) > startTime {
log.WithField(
"Activity Time stamp for the "+name+"system."+name, "Is valid",
).Info("The " + name + "with value system." + set + " in the metrics")
log.WithFields(log.Fields{
"last_activity_ms": item.Path("last_activity_ms").Data().(float64),
"startTime": startTime,
"os": os,
}).Info("The " + name + " with value system." + set + " in the metrics")
}
exist = true
break
Expand Down
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ require (
github.com/Flaque/filet v0.0.0-20201012163910-45f684403088
github.com/Jeffail/gabs/v2 v2.6.0
github.com/cenkalti/backoff/v4 v4.1.0
github.com/cucumber/godog v0.11.0
github.com/cucumber/messages-go/v10 v10.0.3
github.com/docker/cli v20.10.7+incompatible // indirect
github.com/docker/cli v20.10.7+incompatible
github.com/docker/docker v20.10.6+incompatible
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210317102009-a9d74cec0186
github.com/fatih/color v1.12.0 // indirect
github.com/gobuffalo/packr/v2 v2.8.1
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/uuid v1.2.0
github.com/kr/text v0.2.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/sergi/go-diff v1.1.0 // indirect
Expand All @@ -36,5 +33,4 @@ require (
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
gotest.tools/gotestsum v1.6.4 // indirect
)
Loading