Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Jul 23, 2024
1 parent fd6d312 commit 091fff8
Show file tree
Hide file tree
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
Expand Up @@ -20,6 +20,7 @@
package process

import (
"errors"
"os"
"testing"
"time"
Expand All @@ -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)

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

import (
"errors"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 091fff8

Please sign in to comment.