Skip to content

Commit

Permalink
ci: Ensure tests pass even under high load
Browse files Browse the repository at this point in the history
Workers don't accept jobs if the load is too high.

Issua: https://progress.opensuse.org/issues/165198
  • Loading branch information
perlpunk committed Aug 13, 2024
1 parent bdea10a commit e400908
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions t/05-scheduler-full.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ plan skip_all => "set FULLSTACK=1 (be careful)" unless $ENV{FULLSTACK};
setup_mojo_app_with_default_worker_timeout;
OpenQA::Setup::read_config(OpenQA::App->singleton);

# fake "/proc/loadavg" to ensure the test works under a heavy load
my $load_avg_file = tempfile('worker-overall-load-avg-XXXXX');
my $load_avg_file_realpath = $load_avg_file->realpath;
$load_avg_file->spew('0.93 0.95 3.25 2/2207 1212');
$ENV{OPENQA_LOAD_AVG_FILE} = $load_avg_file_realpath;

# setup directories and database
my $tempdir = setup_fullstack_temp_dir('scheduler');
my $schema = OpenQA::Test::Database->new->create(fixtures_glob => '01-jobs.pl 02-workers.pl');
Expand Down
6 changes: 6 additions & 0 deletions t/43-scheduling-and-worker-scalability.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ BEGIN {
setup_mojo_app_with_default_worker_timeout;
OpenQA::Setup::read_config(OpenQA::App->singleton);

# fake "/proc/loadavg" to ensure the test works under a heavy load
my $load_avg_file = tempfile('worker-overall-load-avg-XXXXX');
my $load_avg_file_realpath = $load_avg_file->realpath;
$load_avg_file->spew('0.93 0.95 3.25 2/2207 1212');
$ENV{OPENQA_LOAD_AVG_FILE} = $load_avg_file_realpath;

# read number of workers to spawn from environment variable; skip test entirely if variable not present
# similar to other fullstack tests
my $worker_count = $ENV{SCALABILITY_TEST_WORKER_COUNT};
Expand Down

0 comments on commit e400908

Please sign in to comment.