From 091fff8b4b98c4435f95228e24b0c87bbdf4c6a2 Mon Sep 17 00:00:00 2001 From: Vihas Makwana Date: Tue, 23 Jul 2024 14:58:51 +0530 Subject: [PATCH] fix: test --- metricbeat/module/system/process/process_test.go | 5 +++-- .../module/system/process_summary/process_summary_test.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/metricbeat/module/system/process/process_test.go b/metricbeat/module/system/process/process_test.go index 737b8d615f6..78946913907 100644 --- a/metricbeat/module/system/process/process_test.go +++ b/metricbeat/module/system/process/process_test.go @@ -20,6 +20,7 @@ package process import ( + "errors" "os" "testing" "time" @@ -38,7 +39,7 @@ 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) @@ -46,7 +47,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{})) } assert.NotEmpty(t, events) diff --git a/metricbeat/module/system/process_summary/process_summary_test.go b/metricbeat/module/system/process_summary/process_summary_test.go index a0083c03dc6..1349fd83b47 100644 --- a/metricbeat/module/system/process_summary/process_summary_test.go +++ b/metricbeat/module/system/process_summary/process_summary_test.go @@ -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