]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 577538: Mark certain tests in xt/search.t as being broken only on Pg
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Fri, 9 Jul 2010 02:49:22 +0000 (19:49 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Fri, 9 Jul 2010 02:49:22 +0000 (19:49 -0700)
(and a few as being not broken at all on Pg).
r=mkanat, a=mkanat (module owner)

xt/lib/Bugzilla/Test/Search/Constants.pm
xt/lib/Bugzilla/Test/Search/FieldTest.pm

index 28f0a3f93dc0b528cd62400f4de6b8cd6897fce6..c9d2ef0889e030b252aeaf8234e4d3f4f9091fe0 100644 (file)
@@ -45,6 +45,7 @@ our @EXPORT = qw(
     NUM_SEARCH_TESTS
     OR_BROKEN
     OR_SKIP
+    PG_BROKEN
     SKIP_FIELDS
     SUBSTR_SIZE
     TESTS
@@ -482,6 +483,29 @@ use constant KNOWN_BROKEN => {
     },
 };
 
+# This tracks things that are broken in different ways on Pg compared to
+# MySQL. Actually, in some of these cases, Pg is behaving correctly
+# where MySQL isn't, but the result is still a bit surprising to the user.
+use constant PG_BROKEN => {
+    'attach_data.thedata' => {
+        allwords       => { },
+        allwordssubstr => { },
+        anywords       => { },
+        notregexp      => { contains => [5] },
+        nowords        => { contains => [5] },
+    },
+    percentage_complete => {
+        'allwordssubstr-<1>' => { contains => [3] },
+        anywordssubstr  => { contains => [2,3] },
+        casesubstring   => { contains => [3] },
+        'notregexp-<1>' => { contains => [3] },
+        notsubstring    => { contains => [3] },
+        nowordssubstr   => { contains => [3] },
+        'regexp-<1>'    => { contains => [3] },
+        substring       => { contains => [3] },
+    },
+};
+
 #############
 # Overrides #
 #############
index b0307dec4a9e9ffc47c71850e543581e884c9bea..7ebf760d1c8d07b5f594ddba08e7b5a4642b4690 100644 (file)
@@ -184,8 +184,15 @@ sub _known_broken {
     my $type = $self->field_object->type;
     my $operator = $self->operator;
     my $value = $self->main_value;
-    
     my $value_name = "$operator-$value";
+    
+    if (Bugzilla->dbh->isa('Bugzilla::DB::Pg')) {
+        my $field_broken = PG_BROKEN->{$field}->{$operator};
+        return $field_broken if $field_broken;
+        my $pg_value_broken = PG_BROKEN->{$field}->{$value_name};
+        return $pg_value_broken if $pg_value_broken;
+    }
+    
     my $value_broken = KNOWN_BROKEN->{$value_name}->{$field};
     $value_broken ||= KNOWN_BROKEN->{$value_name}->{$type};
     return $value_broken if $value_broken;