Skip to content

Commit

Permalink
Because retesting is user-synchronous, provide better feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmv committed Mar 13, 2012
1 parent f879e1e commit 9203b7f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bin/local_updates
Expand Up @@ -93,19 +93,22 @@ $worker->register_function(


my $commits = Smokingit::Model::CommitCollection->new; my $commits = Smokingit::Model::CommitCollection->new;
$commits->limit( column => "sha", operator => "like", value => "$sha%" ); $commits->limit( column => "sha", operator => "like", value => "$sha%" );
return 0 unless $commits->count == 1; return "Unknown SHA\n" if $commits->count == 0;
return "Ambiguous SHA\n" if $commits->count > 1;

my @msgs;
my $msg = sub { warn @_; push @msgs, @_ };


my $commit = $commits->next; my $commit = $commits->next;
warn "Retesting @{[$commit->short_sha]}\n";


my $branch; my $branch;


my $configs = $commit->project->configurations; my $configs = $commit->project->configurations;
$configs->limit( column => "name", operator => "MATCHES", value => $configname ) $configs->limit( column => "name", operator => "MATCHES", value => $configname )
if defined $configname and length $configname; if defined $configname and length $configname;
warn "Found @{[$configs->count]} configs\n";
my $tests = 0; my $tests = 0;
while (my $config = $configs->next) { while (my $config = $configs->next) {
my $summary = $commit->short_sha . "[" . $config->name ."]";
my %lookup = ( my %lookup = (
project_id => $commit->project->id, project_id => $commit->project->id,
configuration_id => $config->id, configuration_id => $config->id,
Expand All @@ -114,7 +117,7 @@ $worker->register_function(
my $smoke = Smokingit::Model::SmokeResult->new; my $smoke = Smokingit::Model::SmokeResult->new;
$smoke->load_by_cols( %lookup ); $smoke->load_by_cols( %lookup );
if ($smoke->id) { if ($smoke->id) {
warn "Re-testing @{[$smoke->id]}\n"; $msg->("Re-testing $summary\n");
$smoke->set_submitted_at(undef); $smoke->set_submitted_at(undef);
$smoke->set_gearman_process(undef); $smoke->set_gearman_process(undef);
$tests += $smoke->run_smoke; $tests += $smoke->run_smoke;
Expand All @@ -127,14 +130,14 @@ $worker->register_function(
if @branches == 1; if @branches == 1;
} }
if ($branch->id) { if ($branch->id) {
warn "Testing @{[$commit->short_sha]}[@{[$config->name]}]\n"; $msg->("Testing $summary\n");
$tests += $commit->run_smoke( $config, $branch ); $tests += $commit->run_smoke( $config, $branch );
} else { } else {
warn "No existing smoke for @{[$commit->short_sha]} found, and can't determine branch\n"; $msg->("No existing smoke for $summary found, and can't determine branch\n");
} }
} }
} }
return $tests; return join "", @msgs;
}, },
); );


Expand Down

0 comments on commit 9203b7f

Please sign in to comment.