diff --git a/t/Hydra/Controller/Job/builds.t b/t/Hydra/Controller/Job/builds.t index d933fbb86..aa6a36ce1 100644 --- a/t/Hydra/Controller/Job/builds.t +++ b/t/Hydra/Controller/Job/builds.t @@ -54,13 +54,14 @@ subtest "/job/PROJECT/JOBSET/JOB/shield" => sub { subtest "/job/PROJECT/JOBSET/JOB/prometheus" => sub { my $response = request(GET '/job/' . $project->name . '/' . $jobset->name . '/' . $build->job . '/prometheus'); + ok($response->is_success, "The page showing the job's prometheus data returns 200."); - my $metrics = $response->content; - ok($metrics =~ m/hydra_job_failed\{.*\} 0/); - ok($metrics =~ m/hydra_job_completion_time\{.*\} [\d]+/); - ok($metrics =~ m/hydra_build_closure_size\{.*\} 96/); - ok($metrics =~ m/hydra_build_output_size\{.*\} 96/); + my $metrics = $response->content; + like($metrics, qr/hydra_job_failed\{.*\} 0/); + like($metrics, qr/hydra_job_completion_time\{.*\} [\d]+/); + like($metrics, qr/hydra_build_closure_size\{.*\} 96/); + like($metrics, qr/hydra_build_output_size\{.*\} 96/); }; done_testing; diff --git a/t/Hydra/Controller/Jobset/http.t b/t/Hydra/Controller/Jobset/http.t index 4e53949dc..1a60715cf 100644 --- a/t/Hydra/Controller/Jobset/http.t +++ b/t/Hydra/Controller/Jobset/http.t @@ -186,7 +186,7 @@ subtest 'Update jobset "job" to have an invalid input type' => sub { }) ); ok(!$jobsetupdate->is_success); - ok($jobsetupdate->content =~ m/Invalid input type.*valid types:/); + like($jobsetupdate->content, qr/Invalid input type.*valid types:/); }; diff --git a/t/Hydra/Controller/User/dashboard.t b/t/Hydra/Controller/User/dashboard.t index 8a24585da..12d7dd80e 100644 --- a/t/Hydra/Controller/User/dashboard.t +++ b/t/Hydra/Controller/User/dashboard.t @@ -24,7 +24,7 @@ my $cookie = $login->header("set-cookie"); my $my_jobs = request(GET '/dashboard/alice/my-jobs-tab', Accept => 'application/json', Cookie => $cookie); ok($my_jobs->is_success); my $content = $my_jobs->content(); -ok($content =~ /empty_dir/); +like($content, qr/empty_dir/); ok(!($content =~ /fails/)); ok(!($content =~ /succeed_with_failed/)); done_testing; diff --git a/t/api-test.t b/t/api-test.t index e89d4460c..637d412c7 100644 --- a/t/api-test.t +++ b/t/api-test.t @@ -115,7 +115,7 @@ subtest "evaluation" => sub { my $build = decode_json(request_json({ uri => "/build/" . $evals->[0]->{builds}->[0] })->content()); is($build->{job}, "job", "The build's job name is job"); is($build->{finished}, 0, "The build isn't finished yet"); - ok($build->{buildoutputs}->{out}->{path} =~ /\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the Nix store and named 'job'"); + like($build->{buildoutputs}->{out}->{path}, qr/\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the Nix store and named 'job'"); subtest "search" => sub { my $search_project = decode_json(request_json({ uri => "/search/?query=sample" })->content());