Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve systemd tests and reset stdout/stderr #1563

Merged
merged 1 commit into from
Jun 24, 2019

Conversation

pgombar
Copy link
Contributor

@pgombar pgombar commented Jun 21, 2019

Address leftover comments from #1556:

  • improve systemd tests
  • reset stdout/stderr before invoking another subprocess
  • add unit tests for azurelinuxagent.utils.processutil.read_output
  • add unit tests for logging when calling azurelinuxagent.common.event.add_event

Description

Issue #


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and Travis.CI is passing.

Quality of Code and Contribution Guidelines


This change is Reviewable

@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #1563 into develop will decrease coverage by <.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1563      +/-   ##
===========================================
- Coverage    63.38%   63.38%   -0.01%     
===========================================
  Files           78       78              
  Lines        11056    11057       +1     
  Branches      1559     1559              
===========================================
  Hits          7008     7008              
- Misses        3709     3710       +1     
  Partials       339      339
Impacted Files Coverage Δ
azurelinuxagent/common/cgroupapi.py 62.5% <0%> (-0.28%) ⬇️
azurelinuxagent/common/utils/processutil.py 100% <100%> (ø) ⬆️

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 8761775...42c2570. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jun 21, 2019

Codecov Report

Merging #1563 into develop will decrease coverage by <.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1563      +/-   ##
===========================================
- Coverage    63.38%   63.38%   -0.01%     
===========================================
  Files           78       78              
  Lines        11056    11057       +1     
  Branches      1559     1559              
===========================================
  Hits          7008     7008              
- Misses        3709     3710       +1     
  Partials       339      339
Impacted Files Coverage Δ
azurelinuxagent/common/cgroupapi.py 62.5% <0%> (-0.28%) ⬇️
azurelinuxagent/common/utils/processutil.py 100% <100%> (ø) ⬆️

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 8761775...42c2570. Read the comment docs.

@vrdmr vrdmr self-requested a review June 21, 2019 20:43
@vrdmr
Copy link
Member

vrdmr commented Jun 21, 2019

We might need to add new tests in test_extension.py, with an implementation in TestExtensionWithCGroupsEnabled. Essentially making the test_ext_handler_with_systemd_cgroup_enabled work. When looking at the coverage of the SystemdCgroupAPI, I don't see that the tests you added are still exercising the code in there.

@pgombar
Copy link
Contributor Author

pgombar commented Jun 21, 2019

We might need to add new tests in test_extension.py, with an implementation in TestExtensionWithCGroupsEnabled. Essentially making the test_ext_handler_with_systemd_cgroup_enabled work. When looking at the coverage of the SystemdCgroupAPI, I don't see that the tests you added are still exercising the code in there.

I agree, but this PR is contained to improving tests around systemd-run, not against the whole class. I can do that in a separate PR since it will be a lot of changes.

The issue with test_ext_handler_with_systemd_cgroup_enabled not working is purely because Travis doesn't support cgroups/systemd. When ran locally, the test passes. For the code coverage you linked, a better candidate for testing this would be LaunchCommandTestCase.

Copy link
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

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

LGTM

@pgombar pgombar merged commit ef85621 into Azure:develop Jun 24, 2019
@pgombar pgombar deleted the systemd-test-improvements branch June 24, 2019 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants