Skip to content

Run One Stressor Memory Stress-ng (New) - #2866

Open
mreed8855 wants to merge 5 commits into
mainfrom
run_one_stressor_memory_stress_ng
Open

mreed8855 wants to merge 5 commits into
mainfrom
run_one_stressor_memory_stress_ng

Conversation

@mreed8855

Copy link
Copy Markdown
Collaborator

Description

Add single memory stressor launcher and fix stressor listing

Introduce the capability to run individual memory stressors via a new
`--stressor` flag in `stress_ng_test.py`.

To support this in the test framework:
- Add `memory_stress_ng_stressors` resource job and a single-stressor
  template job (`stress/memory_stressor_{stressor}`).

- Add `--list-stressors` flag to expose available stressors

- Move the `--list-stressors` dispatch prior to root and `stress-ng`
  binary checks so unprivileged resource discovery jobs do not fail.

- Add `memory-single-stressor` test plan and `test-memory-stressor`
  launcher to allow picking specific stressors from the selection menu.

This also allow the running of a subset of memory stressors

Resolved issues

In some instances it can take days or a week or two to run memory stress-ng for systems with a lot of RAM. This helps with debugging single stressors that fail.

Documentation

Tests

Install canonical-certification-server
Run the launcher test-memory-stressor
Select 1 or several stressors
Run

Copilot AI lite review requested due to automatic review settings September 15, 2026 19:04
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.35%. Comparing base (9efa86b) to head (5bb87dc).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2866      +/-   ##
==========================================
+ Coverage   61.31%   61.35%   +0.04%     
==========================================
  Files         499      499              
  Lines       50326    50390      +64     
  Branches     8835     8852      +17     
==========================================
+ Hits        30855    30917      +62     
- Misses      18628    18633       +5     
+ Partials      843      840       -3     
Flag Coverage Δ
provider-certification-server 57.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical workflow and swap-protection issues, along with moderate test and cleanup issues, remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds selectable single-memory-stressor execution for stress-ng, including CLI support, test plans, jobs, and a launcher.

Changes:

  • Adds --stressor and --list-stressors.
  • Adds resource/template jobs and a single-stressor test plan.
  • Adds the certification launcher and unit tests.
File summaries
File Change Review findings
providers/certification-server/launcher/test-memory-stressor Adds the user-facing launcher. Nit (1 vote): document the launcher in the certification-server man page.
providers/base/units/stress/test-plan.pxu Adds the single-stressor test plan. Critical (1 vote): include watchdog lifecycle jobs and ordering metadata. Nit (2 votes): correct the misleading exactly-one selection description.
providers/base/units/stress/stress-ng.yaml Defines resource and templated stressor jobs. Critical (3 votes): provide and align the minimum-swap environment variable so configured swap protection is applied.
providers/base/tests/test_stress_ng_test.py Tests stressor discovery and execution. Moderate (3 votes): reorder patched mock arguments. Moderate (1 vote): add coverage for vm, stack, timeouts, and thread counts.
providers/base/bin/stress_ng_test.py Implements stressor listing and single-stressor execution. Moderate (2 votes): clean up temporary swap when an unknown stressor is supplied.
Review details

Suppressed comments (2)

providers/base/tests/test_stress_ng_test.py:243

  • This test exercises only the matrix constant-runtime branch and checks only the return code. The newly added vm and stack paths choose different timeouts and thread counts, so a regression in those settings would still pass; add assertions/cases for the variable-runtime and low-thread-count stressors.
        ["stress_ng_test.py", "memory", "--stressor", "matrix"],
    )
    def test_main_stress_memory_single_stressor(
        self,
        shutil_which_mock,

providers/certification-server/launcher/test-memory-stressor:1

  • This adds a user-facing installed launcher, but providers/certification-server/debian/canonical-certification-server.rst still omits test-memory-stressor from the documented subset commands; it lists test-memory and test-stress instead. Add the new entry point to the man page so the feature is discoverable.
#!/usr/bin/env checkbox-cli
  • Files reviewed: 4/5 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +43 to +46
requires:
- executable.name == 'stress-ng'
estimated_duration: '300.0'
command: systemd-inhibit stress_ng_test.py memory --stressor {stressor}
Comment on lines +338 to +342
include:
stress/memory_stressor_stressor
bootstrap_include:
memory_stress_ng_stressors
executable
Comment thread providers/base/tests/test_stress_ng_test.py Outdated
Comment thread providers/base/units/stress/test-plan.pxu Outdated
Introduce the capability to run individual memory stressors via a new
`--stressor` flag in `stress_ng_test.py`.

To support this in the test framework:
- Add `memory_stress_ng_stressors` resource job and a single-stressor
  template job (`stress/memory_stressor_{stressor}`).

- Add `--list-stressors` flag to expose available stressors

- Move the `--list-stressors` dispatch prior to root and `stress-ng`
  binary checks so unprivileged resource discovery jobs do not fail.

- Add `memory-single-stressor` test plan and `test-memory-stressor`
  launcher to allow picking specific stressors from the selection menu.

Fixed Black Formatting
Cover the vrt/ltc single-stressor timeout branches, the single-
stressor temporary swap cleanup path, explicit --oom-avoid-bytes, and
the >255GiB RAM 5% OOM-avoidance branch, none of which were exercised
by the existing test suite.
@mreed8855
mreed8855 force-pushed the run_one_stressor_memory_stress_ng branch from 2a1fbab to f663191 Compare September 16, 2026 18:54
mreed8855 and others added 2 commits September 17, 2026 10:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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