Skip to content

Commit 0ff3dc0

Browse files
committed
t: add subtests for resources throttling
Add subtests under priority tests in t/api/04-jobs.t
1 parent c5cfd52 commit 0ff3dc0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

t/api/04-jobs.t

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,26 @@ subtest 'priority correctly assigned when posting job' => sub {
10521052
$t->json_is('/job/priority', 50, 'feature disabled: prio value unchanged');
10531053
};
10541054

1055+
subtest 'priority malus due to high QEMURAM demand' => sub {
1056+
my $add = 40;
1057+
local $jobs_post_params{QEMURAM} = 4096;
1058+
my $limits = OpenQA::App->singleton->config->{misc_limits};
1059+
$limits->{prio_throttling_parameters} = 'QEMURAM:0.01';
1060+
$t->post_ok('/api/v1/jobs', form => \%jobs_post_params)->status_is(200);
1061+
$t->get_ok('/api/v1/jobs/' . $t->tx->res->json->{id})->status_is(200);
1062+
$t->json_is('/job/priority', 50 + $add, 'increased prio value');
1063+
};
1064+
1065+
subtest 'priority malus due to high HDDSIZEGB demand' => sub {
1066+
my $add = 2;
1067+
local $jobs_post_params{HDDSIZEGB} = 40;
1068+
my $limits = OpenQA::App->singleton->config->{misc_limits};
1069+
$limits->{prio_throttling_parameters} = 'XXX :0.2, FAKE_HDDSIZEGB:0.01, HDDSIZEGB:0.05, YYY: 0.1';
1070+
$t->post_ok('/api/v1/jobs', form => \%jobs_post_params)->status_is(200);
1071+
$t->get_ok('/api/v1/jobs/' . $t->tx->res->json->{id})->status_is(200);
1072+
$t->json_is('/job/priority', 50 + $add, 'increased prio value');
1073+
};
1074+
10551075
# post new job in job group with customized default priority
10561076
$schema->resultset('JobGroups')->find({name => 'opensuse test'})->update({default_priority => 42});
10571077
$jobs_post_params{_GROUP} = 'opensuse test';

0 commit comments

Comments
 (0)