16427: Fix test order dependency.
authorTom Clegg <tom@tomclegg.ca>
Mon, 1 Jun 2020 13:42:22 +0000 (09:42 -0400)
committerTom Clegg <tom@tomclegg.ca>
Mon, 1 Jun 2020 13:42:22 +0000 (09:42 -0400)
Test was incorrectly assuming keep2, keep3 data dirs existed.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

lib/undelete/cmd_test.go

index 1ea965995c8ef3ff8bd7289aa19af8ba0520a9fe..e45152d1447206bbf4e22f5209b182a41d128625 100644 (file)
@@ -74,7 +74,16 @@ func (*Suite) TestUntrashAndTouchBlock(c *check.C) {
        }
        c.Logf("keepstore datadirs are %q", datadirs)
 
+       // Currently StartKeep(2, true) uses dirs called "keep0" and
+       // "keep1" so we could just put our fake trashed file in keep0
+       // ... but we don't want to rely on arvadostest's
+       // implementation details, so we put a trashed file in every
+       // dir that keepstore might be using.
        for _, datadir := range datadirs {
+               if fi, err := os.Stat(datadir); err != nil || !fi.IsDir() {
+                       c.Logf("skipping datadir %q, evidently neither keepstore is using it", datadir)
+                       continue
+               }
                trashfile := datadir + "/dcd/dcd0348cb2532ee90c99f1b846efaee7.trash.999999999"
                os.Mkdir(datadir+"/dcd", 0777)
                err = ioutil.WriteFile(trashfile, []byte("undelete test"), 0777)