Skip to content

Commit 37533e5

Browse files
committed
Add unit tests for poll rate control
1 parent 0810743 commit 37533e5

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

unittests/test_policies.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import unittests.utility as test_util
1818

1919
from reframe.core.exceptions import (AbortTaskError,
20+
ConfigError,
2021
FailureLimitError,
2122
ForceExitError,
2223
RunSessionTimeout)
@@ -760,3 +761,61 @@ def test_expected_failures(make_runner, make_loader, make_exec_ctx):
760761
assert len(runner.stats.failed()) == 4
761762
assert len(runner.stats.xfailed()) == 2
762763
assert len(runner.stats.xpassed()) == 2
764+
765+
766+
@pytest.fixture(params=[[100, 200], [-200, -100], [0, -100]])
767+
def invalid_poll_randomize_range(request):
768+
return request.param
769+
770+
771+
def test_invalid_poll_randomize_ms(make_runner, make_exec_ctx,
772+
invalid_poll_randomize_range):
773+
make_exec_ctx(
774+
options={'general/poll_randomize_ms': invalid_poll_randomize_range}
775+
)
776+
with pytest.raises(ConfigError):
777+
make_runner()
778+
779+
780+
@pytest.fixture(params=[-1, 2])
781+
def invalid_poll_rate_decay(request):
782+
return request.param
783+
784+
785+
def test_invalid_poll_rate_decay(make_runner, make_exec_ctx,
786+
invalid_poll_rate_decay):
787+
make_exec_ctx(
788+
options={'general/poll_rate_decay': invalid_poll_rate_decay}
789+
)
790+
with pytest.raises(ConfigError):
791+
make_runner()
792+
793+
794+
@pytest.fixture(params=[-1])
795+
def invalid_poll_rate(request):
796+
return request.param
797+
798+
799+
def test_invalid_poll_rate_min(make_runner, make_exec_ctx, invalid_poll_rate):
800+
make_exec_ctx(
801+
options={'general/poll_rate_min': invalid_poll_rate}
802+
)
803+
with pytest.raises(ConfigError):
804+
make_runner()
805+
806+
807+
def test_invalid_poll_rate_max(make_runner, make_exec_ctx, invalid_poll_rate):
808+
make_exec_ctx(
809+
options={'general/poll_rate_max': invalid_poll_rate}
810+
)
811+
with pytest.raises(ConfigError):
812+
make_runner()
813+
814+
815+
def test_poll_randomize_range_ms(make_runner, make_exec_ctx, make_cases):
816+
make_exec_ctx(
817+
options={'general/poll_randomize_ms': [-100, 500]}
818+
)
819+
runner = make_runner()
820+
runner.runall(make_cases())
821+
assert_runall(runner)

0 commit comments

Comments
 (0)