[Bps-public-commit] smokingit branch, master, updated. 1f19ab7d711cb49d6f4402a2dbc908d8ced68ef0

Alex Vandiver alexmv at bestpractical.com
Sun Nov 10 20:54:41 EST 2013


The branch, master has been updated
       via  1f19ab7d711cb49d6f4402a2dbc908d8ced68ef0 (commit)
       via  b0a988c8b731225f377423705e3b47746270131e (commit)
       via  9924966f1df109266261fdb4bf69f4bb7a16c117 (commit)
      from  fbd2b834832f32a5d89993638de07c267a1693ba (commit)

Summary of changes:
 etc/config.yml                       |  2 +-
 lib/Smokingit/Action/Test.pm         |  6 +++++-
 lib/Smokingit/IRC.pm                 | 12 +++++-------
 lib/Smokingit/Model/Commit.pm        | 23 +++++++++++++++++++++++
 lib/Smokingit/Model/Configuration.pm |  6 ++++++
 lib/Smokingit/Model/Project.pm       |  2 +-
 lib/Smokingit/Status.pm              | 10 +---------
 lib/Smokingit/View/Configuration.pm  |  2 ++
 8 files changed, 44 insertions(+), 19 deletions(-)

- Log -----------------------------------------------------------------
commit 9924966f1df109266261fdb4bf69f4bb7a16c117
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Nov 10 20:53:19 2013 -0500

    Refactor "this commit is fully smoked"

diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index 7cba10e..33f42d1 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -348,12 +348,8 @@ sub do_analyze {
     my $commit = $smoke->commit;
     my $project = $smoke->project;
 
-    warn "Got test result for ".$commit->short_sha;
-
     # First off, have we tested all configurations?
-    return unless $commit->smoke_results->count == $project->configurations->count;
-
-    warn "Have tested all configs";
+    return unless $commit->is_fully_smoked;
 
     # See if we can find the branch for this commit
     my $branch = Smokingit::Model::Branch->new;
diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index a657e62..1b8898d 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -229,6 +229,28 @@ sub long_status {
     return $long{$self->status};
 }
 
+sub is_fully_smoked {
+    my $self = shift;
+
+    my $smoked = Smokingit::Model::SmokeResultCollection->new;
+    $smoked->limit( column => "commit_id", value => $self->id );
+    $smoked->limit( column => "project_id", value => $self->project->id );
+    $smoked->limit(
+        column => "queue_status",
+        operator => "IS",
+        value => "NULL"
+    );
+
+    my $configs = $self->project->configurations;
+
+    my %need;
+    $need{$_->id} = 1 for @{ $configs->items_array_ref };
+    delete $need{$_->configuration->id} for @{ $smoked->items_array_ref };
+
+    return 0 if keys %need;
+    return 1;
+}
+
 sub parents {
     my $self = shift;
     return map {$self->project->sha($_)} split ' ', $self->_value('parents');
diff --git a/lib/Smokingit/Status.pm b/lib/Smokingit/Status.pm
index 1a17285..3c72014 100644
--- a/lib/Smokingit/Status.pm
+++ b/lib/Smokingit/Status.pm
@@ -73,15 +73,7 @@ sub publish {
         status     => $long,
     } );
 
-    my $smoked = Smokingit::Model::SmokeResultCollection->new;
-    $smoked->limit( column => "commit_id", value => $commit->id );
-    $smoked->limit( column => "project_id", value => $smoke->project->id );
-    $smoked->limit(
-        column => "queue_status",
-        operator => "IS",
-        value => "NULL"
-    );
-    return unless $smoked->count == $smoke->project->configurations->count;
+    return unless $commit->is_fully_smoked;
     Jifty->bus->topic("commit_result")->publish( {
         type       => "commit_result",
         sha        => $commit->sha,

commit b0a988c8b731225f377423705e3b47746270131e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Nov 10 20:54:25 2013 -0500

    Allow configurations to not be run automatically, but only on explicit demand

diff --git a/etc/config.yml b/etc/config.yml
index 9cd909d..1b79c8c 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -11,7 +11,7 @@ framework:
     Host: localhost
     Password: ''
     User: postgres
-    Version: 0.0.8
+    Version: 0.0.9
   DevelMode: 1
   LogLevel: INFO
   Mailer: Sendmail
diff --git a/lib/Smokingit/Action/Test.pm b/lib/Smokingit/Action/Test.pm
index d4d1514..8d4ec19 100644
--- a/lib/Smokingit/Action/Test.pm
+++ b/lib/Smokingit/Action/Test.pm
@@ -139,7 +139,11 @@ sub take_action {
         $branch->load_by_cols( name => $branchname, project_id => $commit->project->id);
 
         my $configs = $commit->project->configurations;
-        $configs->limit( column => "id", value => $config ) if $config;
+        if ($config) {
+            $configs->limit( column => "id", value => $config );
+        } else {
+            $configs->limit( column => "auto", value => 1 );
+        }
 
         while (my $config = $configs->next) {
             $commit->run_smoke( $config, $branch );
diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index 33f42d1..79a1d43 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -314,8 +314,10 @@ sub describe_fail {
         return join("$sep ", @lst);
     };
 
-    my $config_count = $commit->project->configurations->count;
     # Are all of the fails across all configurations?
+    my %tested_configs;
+    $tested_configs{$_->configuration->id}++ for @{ $commit->smoke_results->items_array_ref };
+    my $config_count = keys %tested_configs;
     if (scalar values %testnames == grep {keys(%{$_}) == $config_count} values %testnames) {
         return "failing ".$enum->(",", sort keys %testnames);
     }
diff --git a/lib/Smokingit/Model/Commit.pm b/lib/Smokingit/Model/Commit.pm
index 1b8898d..bee62e6 100644
--- a/lib/Smokingit/Model/Commit.pm
+++ b/lib/Smokingit/Model/Commit.pm
@@ -242,6 +242,7 @@ sub is_fully_smoked {
     );
 
     my $configs = $self->project->configurations;
+    $configs->limit( column => "auto", value => 1 );
 
     my %need;
     $need{$_->id} = 1 for @{ $configs->items_array_ref };
diff --git a/lib/Smokingit/Model/Configuration.pm b/lib/Smokingit/Model/Configuration.pm
index 1ea17ec..e1795ab 100644
--- a/lib/Smokingit/Model/Configuration.pm
+++ b/lib/Smokingit/Model/Configuration.pm
@@ -33,6 +33,12 @@ use Smokingit::Record schema {
         is boolean,
         label is 'Parallel testing?',
         default is 't';
+
+    column auto =>
+        is boolean,
+        label is 'Automatically test?',
+        default is 't',
+        since '0.0.9';
 };
 
 sub create {
diff --git a/lib/Smokingit/Model/Project.pm b/lib/Smokingit/Model/Project.pm
index 4c38cbd..4fe4328 100644
--- a/lib/Smokingit/Model/Project.pm
+++ b/lib/Smokingit/Model/Project.pm
@@ -247,7 +247,7 @@ sub schedule_tests {
     }
     return unless @branches;
 
-    my @configs = @{$self->configurations->items_array_ref};
+    my @configs = grep {$_->auto} @{$self->configurations->items_array_ref};
 
     for my $branch (@branches) {
         # If there's nothing else happening, ensure that the tip is tested
diff --git a/lib/Smokingit/View/Configuration.pm b/lib/Smokingit/View/Configuration.pm
index 5d832a4..d8ec7d3 100644
--- a/lib/Smokingit/View/Configuration.pm
+++ b/lib/Smokingit/View/Configuration.pm
@@ -24,6 +24,7 @@ template '/config' => page {
         render_param( $update => "env" );
         render_param( $update => "test_glob" );
         render_param( $update => "parallel" );
+        render_param( $update => "auto" );
         form_submit( label => _("Update"), url => "/project/". $c->project->name . "/");
     };
 };
@@ -49,6 +50,7 @@ template '/new-configuration' => page {
         render_param( $create => "env" );
         render_param( $create => "test_glob" );
         render_param( $create => "parallel" );
+        render_param( $create => "auto" );
         form_submit( label => _("Create"), url => "/project/" . get('project')->name . "/" );
     };
 };

commit 1f19ab7d711cb49d6f4402a2dbc908d8ced68ef0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Sun Nov 10 20:54:34 2013 -0500

    Minor wording tweak

diff --git a/lib/Smokingit/IRC.pm b/lib/Smokingit/IRC.pm
index 79a1d43..56935e1 100644
--- a/lib/Smokingit/IRC.pm
+++ b/lib/Smokingit/IRC.pm
@@ -430,7 +430,7 @@ sub do_analyze {
     } elsif (grep {$_->status ne "passing"} @tested_parents) {
         # A new commit on an existing branch, which passes tests but
         # whose parents didn't!
-        return "$branchname by $author ".
+        return "$branchname by $author now ".
             String::IRC->new("passes tests")->green .
             " as of ".$commit->short_sha;
     } else {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list