From 3c69a3d346adac763b6426538676810921d25646 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 26 Apr 2024 09:36:18 -0400 Subject: [PATCH] 14230: Comment about test coverage, add trailing-** case. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- lib/crunchrun/copier_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/crunchrun/copier_test.go b/lib/crunchrun/copier_test.go index bf7e789e45..30e13f6503 100644 --- a/lib/crunchrun/copier_test.go +++ b/lib/crunchrun/copier_test.go @@ -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{ -- 2.30.2