[Rt-commit] rtir branch, 4.0/upgrade-error-4.4.2, created. 4.0.0-14-gfaa5144

Shawn Moore shawn at bestpractical.com
Thu Dec 1 16:04:11 EST 2016


The branch, 4.0/upgrade-error-4.4.2 has been created
        at  faa5144395765913e2b5404009472c97b08fc6fe (commit)

- Log -----------------------------------------------------------------
commit faa5144395765913e2b5404009472c97b08fc6fe
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Dec 1 20:52:25 2016 +0000

    Include RT 4.4.2 schema changes in the RTIR upgrade test
    
    Fixes: T#175746

diff --git a/t/upgrade/2.6.0-to-current.t b/t/upgrade/2.6.0-to-current.t
index ca78b4e..0836f12 100644
--- a/t/upgrade/2.6.0-to-current.t
+++ b/t/upgrade/2.6.0-to-current.t
@@ -20,15 +20,30 @@ use RT::IR::Test tests => undef;
 
     # upgrade database for RT 4.2.0 on
     {
-        my @versions;
-        for my $version (sort { RT::Handle::cmp_version($a, $b) } map { m{upgrade/([\w.]+)/} && $1 } glob('../rt/etc/upgrade/4.*/')) {
+        my @all_versions = sort { RT::Handle::cmp_version($a, $b) } map { m{upgrade/([\w.]+)/} && $1 } glob('../rt/etc/upgrade/4.*/');
+        my @upgrades;
+        for my $version (@all_versions) {
             next if RT::Handle::cmp_version($version, '4.2.0') == -1;
             next if RT::Handle::cmp_version($version, $RT::VERSION) == 1;
-            push @versions, $version;
+            push @upgrades, $version;
         }
 
-        my ($status, $msg) = RT::IR::Test->apply_upgrade( '../rt/etc/upgrade/', @versions);
-        ok $status, "applied " . scalar(@versions) . " RT version upgrades" or diag "error: $msg";
+        # if we're between versions *and* the last version we collected above
+        # is the same as the penultimate version, then collect the next
+        # version too
+        # as a concrete example, if the RT version is 4.4.1-147-g602fd00
+        # then the above code selects all the upgrades up to and
+        # including 4.4.1, but doesn't include 4.4.2 because it's a
+        # future version. that will cause the test to explode because
+        # 4.4.1-147-g602fd00 needs to include the 4.4.2 schema changes
+        # as well, even though 4.4.2 hasn't even been tagged
+        # yet. so the following check adds that "future" version, 4.4.2
+        push @upgrades, $all_versions[-1]
+            if $RT::VERSION =~ /-/
+            && RT::Handle::cmp_version($all_versions[-2], $upgrades[-1]) == 0;
+
+        my ($status, $msg) = RT::IR::Test->apply_upgrade( '../rt/etc/upgrade/', @upgrades);
+        ok $status, "applied " . scalar(@upgrades) . " RT version upgrades" or diag "error: $msg";
     }
 
     # upgrade database for RTIR 2.6.0 on

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


More information about the rt-commit mailing list