This repository was archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Fix for the OS field and scenarios #1349
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e5737f9
Fixed some minor errors and add one scenario
IgorGuz2000 1270875
fixes by Adam comments
IgorGuz2000 73b7bbe
fix comments
IgorGuz2000 b327c79
Merge branch 'master' into Igor_test_system
IgorGuz2000 98b355d
Merge branch 'master' into Igor_test_system
IgorGuz2000 f58daea
Merge remote-tracking branch 'upstream/master' into Igor_test_system
IgorGuz2000 42c96e6
Merge branch 'master' into Igor_test_system
IgorGuz2000 97692ba
Merge branch 'master' into Igor_test_system
IgorGuz2000 080b0d6
Merge branch 'master' into Igor_test_system
IgorGuz2000 440dcac
fix by Adam comments
IgorGuz2000 aabc2ed
Merge remote-tracking branch 'origin/Igor_test_system' into Igor_test…
IgorGuz2000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1189,6 +1189,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) | ||
|
|
@@ -1262,6 +1272,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) | ||
|
|
||
|
|
@@ -1295,6 +1306,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 | ||
|
|
@@ -1305,6 +1317,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) | ||
|
|
@@ -1315,12 +1329,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") | ||
|
Comment on lines
+1336
to
+1340
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For upcoming PRs, the preferred logging style should be something like this: log.WithFields(log.Fields{
"last_activity_ms": item.Path("last_activity_ms").Data().(float64),
"startTime": startTime,
"os": os,
"integration": name,
"metricset": set,
}).Info("Last activity greater than start time")And maybe using Debug level. |
||
| } | ||
| exist = true | ||
| break | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.