Refactor Linux process CPU measurement tests #107
Conversation
Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
Currently passing tests at iteration >1800 |
Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
Codecov Report
@@ Coverage Diff @@
## master #107 +/- ##
==========================================
- Coverage 39.26% 38.43% -0.84%
==========================================
Files 37 36 -1
Lines 1444 1405 -39
Branches 869 858 -11
==========================================
- Hits 567 540 -27
Misses 70 70
+ Partials 807 795 -12
Continue to review full report at Codecov.
|
Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
..._metrics_collector/test/system_metrics_collector/test_linux_process_cpu_measurement_node.cpp
Show resolved
Hide resolved
..._metrics_collector/test/system_metrics_collector/test_linux_process_cpu_measurement_node.cpp
Show resolved
Hide resolved
..._metrics_collector/test/system_metrics_collector/test_linux_process_cpu_measurement_node.cpp
Outdated
Show resolved
Hide resolved
@@ -77,147 +88,12 @@ class MockLinuxProcessCpuMeasurementNode : public system_metrics_collector:: | |||
private: | |||
system_metrics_collector::ProcPidCpuData MakeSingleMeasurement() override | |||
{ | |||
EXPECT_GT(test_constants::kProcPidSamples.size(), measurement_index_); | |||
return test_constants::kProcPidSamples[measurement_index_++]; | |||
EXPECT_GT(kProcPidSamples.size(), measurement_index_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPECT_GT(kProcPidSamples.size(), measurement_index_); | |
ASSERT_GT(kProcPidSamples.size(), measurement_index_); |
Since the following line will index out of bounds if the EXPECT_EQ
fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use this if the return type was void.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't throw?
..._metrics_collector/test/system_metrics_collector/test_linux_process_cpu_measurement_node.cpp
Show resolved
Hide resolved
Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moves #103 to done
Signed-off-by: Devin Bonnie dbbonnie@amazon.com