Skip to content

Instantly share code, notes, and snippets.

@foursixnine
Last active April 12, 2018 09:02
Show Gist options
  • Save foursixnine/258c52e8861450bb93ee3419f79eefff to your computer and use it in GitHub Desktop.
Save foursixnine/258c52e8861450bb93ee3419f79eefff to your computer and use it in GitHub Desktop.
diff --git a/t/05-scheduler-dependencies.t b/t/05-scheduler-dependencies.t
index 81771028..766d9182 100644
--- a/t/05-scheduler-dependencies.t
+++ b/t/05-scheduler-dependencies.t
@@ -714,11 +714,12 @@ is_deeply($jobD2_h->{parents}->{Chained}, [$jobA2->id], 'jobD2 has jobA2 as chai
is($jobD2_h->{settings}{TEST}, $jobD->TEST, 'jobD2 test and jobD test are equal');
my $jobA2_h = job_get_deps($jobA2->id);
-is_deeply(
- $jobA2_h->{children}->{Chained},
- [$jobB2_h->{id}, $jobC2_h->{id}, $jobD2_h->{id}],
- 'jobA2 has jobB2, jobC2 and jobD2 as children'
-);
+my @a_ = @{$jobA2_h->{children}->{Chained}};
+my @b_ = @{[$jobB2_h->{id}, $jobC2_h->{id}, $jobD2_h->{id}]};
+@a_ = sort { $a <=> $b } @a_;
+@b_ = sort { $a <=> $b } @b_;
+note explain (\@a_, \@b_);
+is_deeply(\@a_, \@b_, 'jobA2 has jobB2, jobC2 and jobD2 as children') or diag explain (\@a_, \@b_);
# situation parent is done, children running -> parent is cloned -> parent is running -> parent is cloned. Check all children has new parent:
# A <- B
@@ -778,19 +779,20 @@ $jobB = _job_create(\%settingsB, undef, [$jobA->id]);
$jobC = _job_create(\%settingsC, [$jobB->id], [$jobA->id]);
$jobD = _job_create(\%settingsD, [$jobB->id], [$jobA->id]);
+$ENV{'DBIC_TRACE'}=1;
# hack jobs to appear done to scheduler
_jobs_update_state([$jobA], OpenQA::Schema::Result::Jobs::DONE, OpenQA::Schema::Result::Jobs::PASSED);
_jobs_update_state([$jobB, $jobC, $jobD], OpenQA::Schema::Result::Jobs::DONE, OpenQA::Schema::Result::Jobs::FAILED);
-
+$schema->storage->debug(1);
$jobA2 = $jobA->auto_duplicate;
$_->discard_changes for ($jobA, $jobB, $jobC, $jobD);
-
# check all children were cloned and has $jobA as parent
for ($jobB, $jobC, $jobD) {
ok($_->clone, 'job cloned');
my $h = job_get_deps($_->clone->id);
is_deeply($h->{parents}{Chained}, [$jobA2->id], 'job has jobA2 as parent');
}
+$schema->storage->debug(0);
for ($jobC, $jobD) {
my $h = job_get_deps($_->clone->id);
@foursixnine
Copy link
Author

foursixnine commented Apr 11, 2018

# [                         
#   100030,                 
#   100031,                               
#   100032                                    
# ]                         
# [                         
#   100032,                 
#   100030,                                
#   100031                                     
# ]                        
not ok 176 - jobA2 has jobB2, jobC2 and jobD2 as children
#   Failed test 'jobA2 has jobB2, jobC2 and jobD2 as children'
#   at t/05-scheduler-dependencies.t line 722.
#     Structures begin differing at:           
#          $got->[0] = '100030'
#     $expected->[0] = '100032'
# [                         
#   100030,                                         
#   100031,
#   100032                            
# ]                                                               
# [                                                                       
#   100032,                                                       
#   100030,
#   100031
# ]

@dasantiago
Copy link

This is what we discussed at the beginning of the week. But there's also other more harder to replicate bugs. :-(

Btw, is_deeply should get references as input and your code is wrong:

my @b_ = [$jobB2_h->{id}, $jobC2_h->{id}, $jobD2_h->{id}];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment