Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Refactor Linux process CPU measurement tests #107

Merged
merged 4 commits into from Mar 5, 2020

Conversation

dabonnie
Copy link
Contributor

@dabonnie dabonnie commented Mar 5, 2020

Moves #103 to done

Signed-off-by: Devin Bonnie dbbonnie@amazon.com

Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
@dabonnie
Copy link
Contributor Author

dabonnie commented Mar 5, 2020

Currently passing tests at iteration >1800

Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
@codecov
Copy link

codecov bot commented Mar 5, 2020

Codecov Report

Merging #107 into master will decrease coverage by 0.83%.
The diff coverage is 20.73%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#unittests 38.43% <20.73%> (-0.84%) ⬇️
Impacted Files Coverage Δ
...etrics_collector/test_linux_memory_measurement.cpp 20.86% <ø> (ø) ⬆️
...m_metrics_collector/test_linux_cpu_measurement.cpp 18.42% <0%> (ø) ⬆️
...tor/test_linux_process_memory_measurement_node.cpp 42.85% <0%> (ø) ⬆️
...lector/test_linux_process_cpu_measurement_node.cpp 25.42% <22.07%> (-10.48%) ⬇️
..._collector/src/moving_average_statistics/types.hpp

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88380ee...12c8a0d. Read the comment docs.

Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
@@ -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_);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't throw?

Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
Copy link
Contributor

@piraka9011 piraka9011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@dabonnie dabonnie merged commit 994cc7f into master Mar 5, 2020
@dabonnie dabonnie deleted the dabonnie/fix-process-cpu-measurement-test branch March 5, 2020 22:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants