From 6f4ee914f75fa5d9caced64d56abe03b77a0f524 Mon Sep 17 00:00:00 2001 From: gezimbll Date: Tue, 2 Apr 2024 05:25:37 -0400 Subject: [PATCH] revised meprofile &cpuprofile tests --- apier/v1/core_it_test.go | 4 +++- apier/v1/dispatcher_it_test.go | 3 +-- apier/v1/filters_it_test.go | 3 +-- apier/v1/thresholds_it_test.go | 2 +- ees/poster_it_test.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apier/v1/core_it_test.go b/apier/v1/core_it_test.go index 206c8f0eb..135cca802 100644 --- a/apier/v1/core_it_test.go +++ b/apier/v1/core_it_test.go @@ -209,6 +209,7 @@ func testCoreSv1StopMemoryProfiling(t *testing.T) { } else if reply != utils.OK { t.Errorf("Unexpected reply returned") } + time.Sleep(10 * time.Millisecond) //mem_prof1, mem_prof2 for i := 1; i <= 2; i++ { @@ -310,6 +311,7 @@ func testCoreSv1StopCPUProfiling(t *testing.T) { } else if reply != utils.OK { t.Errorf("Unexpected reply returned") } + file, err := os.Open(path.Join(argPath, utils.CpuPathCgr)) if err != nil { t.Error(err) @@ -320,7 +322,7 @@ func testCoreSv1StopCPUProfiling(t *testing.T) { size, err := file.Stat() if err != nil { t.Error(err) - } else if size.Size() < int64(415) { + } else if size.Size() < int64(300) { t.Errorf("Size of CPUProfile %v is lower that expected", size.Size()) } //after we checked that CPUProfile was made successfully, can delete it diff --git a/apier/v1/dispatcher_it_test.go b/apier/v1/dispatcher_it_test.go index a59f1b281..7eb253b42 100644 --- a/apier/v1/dispatcher_it_test.go +++ b/apier/v1/dispatcher_it_test.go @@ -413,12 +413,11 @@ func testV1DispatcherStopCPUProfiling(t *testing.T) { t.Error(err) } defer file.Close() - //compare the size size, err := file.Stat() if err != nil { t.Error(err) - } else if size.Size() < int64(415) { + } else if size.Size() < int64(300) { t.Errorf("Size of CPUProfile %v is lower that expected", size.Size()) } //after we checked that CPUProfile was made successfully, can delete it diff --git a/apier/v1/filters_it_test.go b/apier/v1/filters_it_test.go index a0feb85cc..97e70944f 100644 --- a/apier/v1/filters_it_test.go +++ b/apier/v1/filters_it_test.go @@ -302,12 +302,11 @@ func testFilterStopCPUProfiling(t *testing.T) { t.Error(err) } defer file.Close() - //compare the size size, err := file.Stat() if err != nil { t.Error(err) - } else if size.Size() < int64(415) { + } else if size.Size() < int64(300) { t.Errorf("Size of CPUProfile %v is lower that expected", size.Size()) } //after we checked that CPUProfile was made successfully, can delete it diff --git a/apier/v1/thresholds_it_test.go b/apier/v1/thresholds_it_test.go index b0a99bad2..ea5e44dc6 100644 --- a/apier/v1/thresholds_it_test.go +++ b/apier/v1/thresholds_it_test.go @@ -1002,7 +1002,7 @@ func testV1ThresholdStopCPUProfiling(t *testing.T) { size, err := file.Stat() if err != nil { t.Error(err) - } else if size.Size() < int64(415) { + } else if size.Size() < int64(300) { t.Errorf("Size of CPUProfile %v is lower that expected", size.Size()) } //after we checked that CPUProfile was made successfully, can delete it diff --git a/ees/poster_it_test.go b/ees/poster_it_test.go index 90d0e2384..7927a7076 100644 --- a/ees/poster_it_test.go +++ b/ees/poster_it_test.go @@ -156,7 +156,7 @@ func TestHttpBytesPoster(t *testing.T) { RPC: &config.RPCOpts{}, }) time.Sleep(5 * time.Millisecond) - fs, err := filepath.Glob("/tmp/test2*") + fs, err := filepath.Glob("/tmp/EEs|*") if err != nil { t.Fatal(err) } else if len(fs) == 0 {