Depends on https://github.com/nix-community/nix-eval-jobs/pull/349 & #1421. Almost equivalent to #1425, but with a small change: when having e.g. an aggregate job with a glob that matches nothing, the jobset evaluation is failed now. This was the intended behavior before (hydra-eval-jobset fails hard if an aggregate is broken), the code-path was never reached however since the aggregate was never marked as broken in this case before.
		
			
				
	
	
		
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Perl
		
	
	
	
	
	
| use strict;
 | ||
| use warnings;
 | ||
| use Setup;
 | ||
| use Test2::V0;
 | ||
| use Hydra::Helper::Exec;
 | ||
| 
 | ||
| my $ctx = test_context();
 | ||
| 
 | ||
| subtest "broken constituents expression" => sub {
 | ||
|     my $jobsetCtx = $ctx->makeJobset(
 | ||
|         expression => 'constituents-broken.nix',
 | ||
|     );
 | ||
|     my $jobset = $jobsetCtx->{"jobset"};
 | ||
| 
 | ||
|     my ($res, $stdout, $stderr) = captureStdoutStderr(60,
 | ||
|         ("hydra-eval-jobset", $jobsetCtx->{"project"}->name, $jobset->name)
 | ||
|     );
 | ||
|     isnt($res, 0, "hydra-eval-jobset exits non-zero");
 | ||
|     ok(utf8::decode($stderr), "Stderr output is UTF8-clean");
 | ||
|     like(
 | ||
|         $stderr,
 | ||
|         qr/aggregate job 'mixed_aggregate' references non-existent job 'constituentA'/,
 | ||
|         "The stderr record includes a relevant error message"
 | ||
|     );
 | ||
| 
 | ||
|     $jobset->discard_changes({ '+columns' => {'errormsg' => 'errormsg'} });  # refresh from DB
 | ||
|     like(
 | ||
|         $jobset->errormsg,
 | ||
|         qr/aggregate job ‘mixed_aggregate’ failed with the error: constituentA: does not exist/,
 | ||
|         "The jobset records a relevant error message"
 | ||
|     );
 | ||
| };
 | ||
| 
 | ||
| subtest "no matches" => sub {
 | ||
|     my $jobsetCtx = $ctx->makeJobset(
 | ||
|         expression => 'constituents-no-matches.nix',
 | ||
|     );
 | ||
|     my $jobset = $jobsetCtx->{"jobset"};
 | ||
| 
 | ||
|     my ($res, $stdout, $stderr) = captureStdoutStderr(60,
 | ||
|         ("hydra-eval-jobset", $jobsetCtx->{"project"}->name, $jobset->name)
 | ||
|     );
 | ||
|     isnt($res, 0, "hydra-eval-jobset exits non-zero");
 | ||
|     ok(utf8::decode($stderr), "Stderr output is UTF8-clean");
 | ||
|     like(
 | ||
|         $stderr,
 | ||
|         qr/aggregate job 'non_match_aggregate' references constituent glob pattern 'tests\.\*' with no matches/,
 | ||
|         "The stderr record includes a relevant error message"
 | ||
|     );
 | ||
| 
 | ||
|     $jobset->discard_changes({ '+columns' => {'errormsg' => 'errormsg'} });  # refresh from DB
 | ||
|     like(
 | ||
|         $jobset->errormsg,
 | ||
|         qr/aggregate job ‘non_match_aggregate’ failed with the error: tests\.\*: constituent glob pattern had no matches/,
 | ||
|         qr/in job ‘non_match_aggregate’:\ntests\.\*: constituent glob pattern had no matches/,
 | ||
|         "The jobset records a relevant error message"
 | ||
|     );
 | ||
| };
 | ||
| 
 | ||
| done_testing;
 |