Update tests for go 1.16.
authorTom Clegg <tom@curii.com>
Tue, 4 May 2021 17:52:08 +0000 (13:52 -0400)
committerTom Clegg <tom@curii.com>
Tue, 4 May 2021 18:44:15 +0000 (14:44 -0400)
No issue #

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

build/run-tests.sh
sdk/go/arvados/duration.go
sdk/go/arvados/duration_test.go
services/keepstore/unix_volume_test.go

index d6dc43416a5bc8bf8e3aab56c0a5df78c2e759e5..e309d24011d4f01079ae7707c2e6b1f0bbd45832 100755 (executable)
@@ -1147,6 +1147,14 @@ test_all() {
     do_test apps/workbench_profile
 }
 
+test_go() {
+    do_test gofmt
+    for g in "${gostuff[@]}"
+    do
+        do_test "$g" go
+    done
+}
+
 help_interactive() {
     echo "== Interactive commands:"
     echo "TARGET                 (short for 'test DIR')"
index ee482fdf3150f6a2baf126d4d540f2479fe6ba69..c922f0a30dd49abd0f11b29f94d2ced6a8ea09cb 100644 (file)
@@ -22,7 +22,7 @@ func (d *Duration) UnmarshalJSON(data []byte) error {
        }
        // Mimic error message returned by ParseDuration for a number
        // without units.
-       return fmt.Errorf("missing unit in duration %s", data)
+       return fmt.Errorf("missing unit in duration %q", data)
 }
 
 // MarshalJSON implements json.Marshaler.
index 86fe218c3361a1b986e0cd38ab09a39eac1ec9bc..fa0ef0aeca80d72448c65748efb6833e8db01812 100644 (file)
@@ -50,13 +50,13 @@ func (s *DurationSuite) TestUnmarshalJSON(c *check.C) {
                D Duration
        }
        err := json.Unmarshal([]byte(`{"D":1.234}`), &d)
-       c.Check(err, check.ErrorMatches, `missing unit in duration 1.234`)
+       c.Check(err, check.ErrorMatches, `.*missing unit in duration "?1\.234"?`)
        err = json.Unmarshal([]byte(`{"D":"1.234"}`), &d)
-       c.Check(err, check.ErrorMatches, `.*missing unit in duration 1.234`)
+       c.Check(err, check.ErrorMatches, `.*missing unit in duration "?1\.234"?`)
        err = json.Unmarshal([]byte(`{"D":"1"}`), &d)
-       c.Check(err, check.ErrorMatches, `.*missing unit in duration 1`)
+       c.Check(err, check.ErrorMatches, `.*missing unit in duration "?1"?`)
        err = json.Unmarshal([]byte(`{"D":"foobar"}`), &d)
-       c.Check(err, check.ErrorMatches, `.*invalid duration foobar`)
+       c.Check(err, check.ErrorMatches, `.*invalid duration "foobar"`)
        err = json.Unmarshal([]byte(`{"D":"60s"}`), &d)
        c.Check(err, check.IsNil)
        c.Check(d.D.Duration(), check.Equals, time.Minute)
index 6b42dbc519ac933a0ddca0092fc1b14fb1b599d8..166085809848b862a734096a4f1ff9c28223fdde 100644 (file)
@@ -395,7 +395,7 @@ func (s *UnixVolumeSuite) TestStats(c *check.C) {
        c.Check(err, check.NotNil)
        c.Check(stats(), check.Matches, `.*"StatOps":[^0],.*`)
        c.Check(stats(), check.Matches, `.*"Errors":[^0],.*`)
-       c.Check(stats(), check.Matches, `.*"\*os\.PathError":[^0].*`)
+       c.Check(stats(), check.Matches, `.*"\*(fs|os)\.PathError":[^0].*`) // os.PathError changed to fs.PathError in Go 1.16
        c.Check(stats(), check.Matches, `.*"InBytes":0,.*`)
        c.Check(stats(), check.Matches, `.*"OpenOps":0,.*`)
        c.Check(stats(), check.Matches, `.*"CreateOps":0,.*`)