Skip to content

Conversation

Wabri
Copy link
Member

@Wabri Wabri commented Sep 2, 2025

@Wabri Wabri self-assigned this Sep 2, 2025
@Wabri Wabri force-pushed the feat/178948/plugin/memorylimit branch 3 times, most recently from 01ee10f to a323eda Compare September 3, 2025 09:35
Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

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

I'd avoid the use of "assignation" in this context as "assignment" is much more conventional here. The commit message should probably just be "Use signatures in memory limit plugin" anyway, though.

use_ok('OpenQA::WebAPI::Plugin::MemoryLimit');

my $app = Mojolicious->new;
OpenQA::WebAPI::Plugin::MemoryLimit->register($app);
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is still not setting max_rss_limit to something > 0 and even if it would the relevant code wouldn't be executed as the test needed to run the event loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mh you are right, but I was sure to have it at one point 😕

Copy link
Contributor

Choose a reason for hiding this comment

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

Your new version still doesn't run the event loop. Probably you'll just have to start it and the code under test will then stop it on its own. You probably want to make the hard-coded timer interval configurable so the test doesn't waste 5 seconds.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would also make sense to check whether Worker exceeded RSS limit is printed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yas, you are right... I've try to test it, but I guess I miss some knowledge on https://docs.mojolicious.org/Mojo/IOLoop

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, you've already found the documentation :-)

@Wabri Wabri force-pushed the feat/178948/plugin/memorylimit branch from a323eda to 0cd6cfe Compare September 3, 2025 13:55
@Wabri Wabri force-pushed the feat/178948/plugin/memorylimit branch from 0cd6cfe to 6068cc9 Compare September 3, 2025 13:56
Copy link

codecov bot commented Sep 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (b5ecb3e) to head (6068cc9).
⚠️ Report is 33 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6693   +/-   ##
=======================================
  Coverage   99.22%   99.23%           
=======================================
  Files         398      399    +1     
  Lines       40888    40895    +7     
=======================================
+ Hits        40571    40581   +10     
+ Misses        317      314    -3     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Wabri Wabri changed the title t: run at least once Memorylimit register with max_rss_limit > 0 Fully Cover OpenQA::WebAPI::Plugin::MemoryLimit Sep 3, 2025
@Wabri Wabri added the not-ready label Sep 5, 2025
my $app = Mojolicious->new;
$app->config->{global}{max_rss_limit} = 42;
OpenQA::WebAPI::Plugin::MemoryLimit->register($app, undef);

Copy link
Contributor

@Martchus Martchus Sep 5, 2025

Choose a reason for hiding this comment

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

Suggested change
Mojo::IOLoop->start;

I guess you can set the conditions so the code under test will stop the loop automatically. And you should make the interval configurable to avoid wasting 5 seconds until that would happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants