14230: Comment about test coverage, add trailing-** case.
authorTom Clegg <tom@curii.com>
Fri, 26 Apr 2024 13:36:18 +0000 (09:36 -0400)
committerTom Clegg <tom@curii.com>
Fri, 26 Apr 2024 13:36:18 +0000 (09:36 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/crunchrun/copier_test.go

index bf7e789e458a549b12c2659be5ada151e0542e29..30e13f65033eef8dc2e93d5a0ba3acbd6356b155 100644 (file)
@@ -225,6 +225,12 @@ func (s *copierSuite) writeFileInOutputDir(c *check.C, path, data string) {
        c.Assert(f.Close(), check.IsNil)
 }
 
+// applyGlobsToFilesAndDirs uses the same glob-matching code as
+// applyGlobsToCollectionFS, so we don't need to test all of the same
+// glob-matching behavior covered in TestApplyGlobsToCollectionFS.  We
+// do need to check that (a) the glob is actually being used to filter
+// out files, and (b) non-matching dirs still included if and only if
+// they are ancestors of matching files.
 func (s *copierSuite) TestApplyGlobsToFilesAndDirs(c *check.C) {
        dirs := []string{"dir1", "dir1/dir11", "dir1/dir12", "dir2"}
        files := []string{"dir1/file11", "dir1/dir11/file111", "dir2/file2"}
@@ -273,6 +279,11 @@ func (s *copierSuite) TestApplyGlobsToFilesAndDirs(c *check.C) {
                        dirs:  []string{"dir1", "dir1/dir11"},
                        files: nil,
                },
+               {
+                       globs: []string{"dir1/**"},
+                       dirs:  []string{"dir1", "dir1/dir11", "dir1/dir12"},
+                       files: []string{"dir1/file11", "dir1/dir11/file111"},
+               },
        } {
                c.Logf("=== globs: %q", trial.globs)
                cp := copier{