diff --git a/t/05-scheduler-full.t b/t/05-scheduler-full.t index 7cd2c2205cd..47fce181ceb 100644 --- a/t/05-scheduler-full.t +++ b/t/05-scheduler-full.t @@ -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'); diff --git a/t/43-scheduling-and-worker-scalability.t b/t/43-scheduling-and-worker-scalability.t index a97b4fa21e8..d5607813851 100644 --- a/t/43-scheduling-and-worker-scalability.t +++ b/t/43-scheduling-and-worker-scalability.t @@ -9,7 +9,7 @@ use Test::MockModule; use Time::HiRes 'sleep'; use File::Path 'make_path'; use Scalar::Util 'looks_like_number'; -use Mojo::File 'path'; +use Mojo::File qw(path tempfile); use Mojo::Util 'dumper'; use IPC::Run qw(start); use FindBin; @@ -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};