Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
VihasMakwana committed Jul 23, 2024
1 parent fd6d312 commit 091fff8
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions metricbeat/module/system/process/process_test.go
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
package process

import (
"errors"
"os"
"testing"
"time"
@@ -38,15 +39,15 @@ func TestFetch(t *testing.T) {
f := mbtest.NewReportingMetricSetV2Error(t, getConfig())
events, errs := mbtest.ReportingFetchV2Error(f)
for _, err := range errs {
assert.True(t, process.CanDegrade(err))
assert.True(t, errors.Is(err, process.NonFatalErr{}))
}
assert.NotEmpty(t, events)

time.Sleep(2 * time.Second)

events, errs = mbtest.ReportingFetchV2Error(f)
for _, err := range errs {
assert.True(t, process.CanDegrade(err))
assert.True(t, errors.Is(err, process.NonFatalErr{}))
}
assert.NotEmpty(t, events)

Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
package process_summary

import (
"errors"
"testing"

"github.com/stretchr/testify/assert"
@@ -47,7 +48,7 @@ func TestFetch(t *testing.T) {
events, errs := mbtest.ReportingFetchV2Error(f)

for _, err := range errs {
assert.True(t, process.CanDegrade(err))
assert.True(t, errors.Is(err, process.NonFatalErr{}))
}
require.NotEmpty(t, events)
event := events[0].BeatEvent("system", "process_summary").Fields
@@ -65,7 +66,7 @@ func TestStateNames(t *testing.T) {
events, errs := mbtest.ReportingFetchV2Error(f)

for _, err := range errs {
assert.True(t, process.CanDegrade(err))
assert.True(t, errors.Is(err, process.NonFatalErr{}))
}
require.NotEmpty(t, events)
event := events[0].BeatEvent("system", "process_summary").Fields

0 comments on commit 091fff8

Please sign in to comment.