Skip to content

Commit dc9e515

Browse files
committed
skip offending test on misbehaving servers - another way
1 parent 7e893ef commit dc9e515

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

driver_test.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ func (t timeTest) run(dbt *DBTest, dbtype, tlayout string, mode timeMode) {
415415
if str == t.s {
416416
return
417417
}
418+
if mode.Binary() && dbtype == "DATETIME" && len(str) == 26 && str[:19] == t.s {
419+
// a fix mainly for TravisCI:
420+
// accept full microsecond resolution in result for DATETIME columns
421+
// where the binary protocol was used
422+
return
423+
}
418424
dbt.Errorf("%s [%s] to string: expected %q, got %q",
419425
dbtype, mode,
420426
t.s, str,
@@ -534,13 +540,6 @@ func TestDateTime(t *testing.T) {
534540
rows.Scan(&allowsZero)
535541
rows.Close()
536542
}
537-
// Fix for TravisCI with its "special" MySQL version
538-
var datetimeAutofracs bool
539-
rows, err = dbt.db.Query(`SELECT length(concat('',cast(? as DATETIME))) != 19`, "2011-11-20 21:27:37")
540-
if err == nil {
541-
rows.Scan(&datetimeAutofracs)
542-
rows.Close()
543-
}
544543
for _, setups := range testcases {
545544
if t := setups.dbtype; !withFrac && t[len(t)-1:] == ")" {
546545
// skip fractional second tests if unsupported by server
@@ -561,9 +560,6 @@ func TestDateTime(t *testing.T) {
561560
// skip disallowed 0000-00-00 date
562561
continue
563562
}
564-
if datetimeAutofracs && setups.dbtype == "DATETIME" && setup.t != t0 {
565-
continue
566-
}
567563
setup.run(dbt, setups.dbtype, setups.tlayout, textString)
568564
setup.run(dbt, setups.dbtype, setups.tlayout, binaryString)
569565
if allowBinTime {

0 commit comments

Comments
 (0)