[Bps-public-commit] smokingit branch, full-tap, created. eab7e8cb24986e50def81012abc5127383937a7f

Alex Vandiver alexmv at bestpractical.com
Fri Jul 19 01:17:46 EDT 2013


The branch, full-tap has been created
        at  eab7e8cb24986e50def81012abc5127383937a7f (commit)

- Log -----------------------------------------------------------------
commit 215b61964c79f0e9186c9dd0c7bca0bf579199a7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 21 11:47:03 2013 -0700

    Switch to clients sending raw TAP, not the parsed data from the aggregator

diff --git a/etc/config.yml b/etc/config.yml
index 1b9d03a..5716b09 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -11,7 +11,7 @@ framework:
     Host: localhost
     Password: ''
     User: postgres
-    Version: 0.0.7
+    Version: 0.0.8
   DevelMode: 1
   LogLevel: INFO
   Mailer: Sendmail
diff --git a/lib/Smokingit/Model/SmokeFileResult.pm b/lib/Smokingit/Model/SmokeFileResult.pm
new file mode 100644
index 0000000..311015f
--- /dev/null
+++ b/lib/Smokingit/Model/SmokeFileResult.pm
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+
+package Smokingit::Model::SmokeFileResult;
+use Jifty::DBI::Schema;
+use Smokingit::Status;
+
+use Smokingit::Record schema {
+    column smoke_result_id =>
+        is mandatory,
+        references Smokingit::Model::SmokeResult,
+        is indexed;
+
+    column filename  => type is 'text';
+    column elapsed   => type is 'float';
+    column is_ok     => is boolean;
+    column raw_tap   => type is 'text';
+    column tests_run => type is 'integer';
+};
+
+sub since { '0.0.8' }
+
+sub is_protected {1}
+
+sub current_user_can {
+    my $self  = shift;
+    my $right = shift;
+    my %args  = (@_);
+
+    return 1 if $right eq 'read';
+
+    return $self->SUPER::current_user_can($right => %args);
+}
+
+1;
diff --git a/lib/Smokingit/Model/SmokeResult.pm b/lib/Smokingit/Model/SmokeResult.pm
index 75ce7fe..0e072cb 100644
--- a/lib/Smokingit/Model/SmokeResult.pm
+++ b/lib/Smokingit/Model/SmokeResult.pm
@@ -47,7 +47,8 @@ use Smokingit::Record schema {
 
     column aggregator =>
         type is 'blob',
-        filters are 'Jifty::DBI::Filter::Storable';
+        filters are 'Jifty::DBI::Filter::Storable',
+        till '0.0.8';
 
     column is_ok        => is boolean;
 
@@ -58,11 +59,13 @@ use Smokingit::Record schema {
     column skipped      => type is 'integer';
     column todo         => type is 'integer';
     column todo_passed  => type is 'integer';
+    column total        => type is 'integer',
+        since '0.0.8';
 
     column wait         => type is 'integer';
     column exit         => type is 'integer';
 
-    column elapsed      => type is 'integer';
+    column elapsed      => type is 'float';
 };
 sub is_protected {1}
 
@@ -138,31 +141,10 @@ sub post_result {
     my ($arg) = @_;
 
     my %result = %{ $arg };
+    delete $result{start};
+    delete $result{end};
 
-    # Properties to extract from the aggregator
-    my @props =
-        qw/failed
-           parse_errors
-           passed
-           planned
-           skipped
-           todo
-           todo_passed
-           wait
-           exit/;
-
-    # Aggregator might not exist if we had a configure failure
-    require TAP::Parser::Aggregator;
-    my $a = $result{aggregator};
-    if ($a) {
-        $result{$_} = $a->$_ for @props;
-        $result{is_ok}      = not($a->has_problems);
-        $result{elapsed}    = $a->elapsed->[0];
-        $result{error}      = undef;
-    } else {
-        # Unset the existing data if there was a fail
-        $result{$_} = undef for @props, "is_ok", "elapsed";
-    }
+    my %tests = %{ delete $result{test} };
 
     my $status = Smokingit::Status->new( $self );
 
@@ -190,6 +172,29 @@ sub post_result {
     # Mark as no longer smoking
     $self->set_queue_status(undef);
 
+    # Delete all previous test file results
+    my $testfiles = Smokingit::Model::SmokeFileResultCollection->new(
+        current_user => Smokingit::CurrentUser->superuser,
+    );
+    $testfiles->limit( column => "smoke_result_id", value => $self->id );
+    while (my $fileresult = $testfiles->next) {
+        $fileresult->delete;
+    }
+
+    # Create rows for all test files
+    for my $filename (sort keys %tests) {
+        my $fileresult = Smokingit::Model::SmokeFileResult->new(
+            current_user => Smokingit::CurrentUser->superuser,
+        );
+        my ($ok, $msg) = $fileresult->create(
+            %{$tests{$filename}},
+            filename => $filename,
+            smoke_result_id => $self->id,
+        );
+        warn "Failed to create entry for $filename: $msg"
+            unless $ok;
+    }
+
     # And commit all of that
     Jifty->handle->commit;
 
diff --git a/lib/Smokingit/Upgrade.pm b/lib/Smokingit/Upgrade.pm
index 3236a9a..c8813de 100644
--- a/lib/Smokingit/Upgrade.pm
+++ b/lib/Smokingit/Upgrade.pm
@@ -34,4 +34,9 @@ since '0.0.4' => sub {
     }
 };
 
+# Time elapsed became a float
+since '0.0.8' => sub {
+    Jifty->handle->simple_query("ALTER TABLE smoke_results ALTER COLUMN elapsed TYPE float");
+};
+
 1;
diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index 2ab3c23..cf09412 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -20,11 +20,6 @@ template '/smoke' => page {
         return;
     }
 
-    my $a = $s->aggregator;
-    pre {
-        YAML::Dump($a);
-    };
-
 };
 
 1;

commit 91fa87b7ef7c1939aef2ec6d91720acef558fb86
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 28 16:50:33 2013 -0400

    Link test results from commit pages

diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index cf09412..8aba98f 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -7,6 +7,24 @@ use Jifty::View::Declare -base;
 template '/commit' => page {
     redirect '/' unless get('commit');
     page_title is get('commit')->short_sha;
+
+    my $commit = get('commit');
+
+    ul {
+        my $configs = $b->project->configurations;
+        while (my $config = $configs->next) {
+            li {
+                my $smoke = Smokingit::Model::SmokeResult->new;
+                $smoke->load_by_cols(
+                    project_id       => $commit->project->id,
+                    configuration_id => $config->id,
+                    commit_id        => $commit->id,
+                );
+                next unless $smoke->id;
+                Smokingit::View::test_result( $smoke );
+            }
+        }
+    }
 };
 
 template '/smoke' => page {

commit eab7e8cb24986e50def81012abc5127383937a7f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jun 28 16:51:42 2013 -0400

    Bare-bones passing/failing test list for smoke results

diff --git a/lib/Smokingit/View/Commit.pm b/lib/Smokingit/View/Commit.pm
index 8aba98f..28589ee 100644
--- a/lib/Smokingit/View/Commit.pm
+++ b/lib/Smokingit/View/Commit.pm
@@ -38,6 +38,20 @@ template '/smoke' => page {
         return;
     }
 
+    my $results = Smokingit::Model::SmokeFileResultCollection->new;
+    $results->limit( column => "smoke_result_id", value => $s->id );
+    $results->order_by( column => "filename" );
+    $results->columns( "filename", "is_ok", "elapsed" );
+    while (my $result = $results->next) {
+        div {
+            class is ($result->is_ok ? "passingfile" : "failingfile");
+            outs $result->filename;
+            span {
+                class is "elapsed";
+                outs sprintf "(%.2fs)", $result->elapsed;
+            };
+        };
+    }
 };
 
 1;
diff --git a/share/web/static/css/app-late.css b/share/web/static/css/app-late.css
index f5e2456..6dd7fe9 100644
--- a/share/web/static/css/app-late.css
+++ b/share/web/static/css/app-late.css
@@ -1,3 +1,5 @@
+ at import "testresults.css";
+
 html {
   padding: .75em;
   background: #223;
@@ -352,15 +354,6 @@ li {
 }
 
 
-/* Commit pages */
-.failingtest .header {
-  border-bottom: 5px dotted #f11;
-}
-.passingtest .header {
-  border-bottom: 5px dotted #1c1;
-}
-
-
 /* Footer and escaping smoke in the corner */
 #footer {
   position: absolute;
diff --git a/share/web/static/css/testresults.css b/share/web/static/css/testresults.css
new file mode 100644
index 0000000..869ec51
--- /dev/null
+++ b/share/web/static/css/testresults.css
@@ -0,0 +1,24 @@
+/* Commit pages */
+.failingtest .header {
+    border-bottom: 5px dotted #f11;
+}
+.passingtest .header {
+    border-bottom: 5px dotted #1c1;
+}
+
+.passingfile, .failingfile {
+    margin-right: auto;
+    margin-left: auto;
+}
+
+.passingfile {
+    border: 1px solid #cfc;
+    border-collapse: collapse;
+    padding: 0.1em 1em;
+    background-color: #beb;
+}
+
+.elapsed {
+    position: absolute;
+    right: 2em;
+}
\ No newline at end of file

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



More information about the Bps-public-commit mailing list