@@ -364,11 +364,13 @@ source = "` + sourcePattern + `"
364364}
365365
366366func TestPathAndTagInRetention (t * testing.T ) {
367- root , err := filepath .Abs ("/" )
367+ examples , err := filepath .Abs ("../examples" )
368+ require .NoError (t , err )
369+ sourcePattern := filepath .ToSlash (filepath .Join (examples , "[a-p]*" ))
370+ backupSource , err := filepath .Glob (sourcePattern )
371+ require .Greater (t , len (backupSource ), 5 )
368372 require .NoError (t , err )
369- root = filepath .ToSlash (root )
370373
371- backupSource := []string {root }
372374 backupTags := []string {"one" , "two" }
373375
374376 testProfile := func (t * testing.T , version Version , retention string ) * Profile {
@@ -382,12 +384,13 @@ func TestPathAndTagInRetention(t *testing.T) {
382384
383385 [` + p + `profile.backup]
384386 tag = ["one", "two"]
385- source = ["` + root + `"]
387+ source = ["` + sourcePattern + `"]
386388
387389 [` + p + `profile.retention]
388390 ` + retention
389391
390392 profile , err := getResolvedProfile ("toml" , config , "profile" )
393+ profile .SetRootPath (examples ) // ensure relative paths are converted to absolute paths
391394 require .NoError (t , err )
392395 require .NotNil (t , profile )
393396
@@ -412,11 +415,8 @@ func TestPathAndTagInRetention(t *testing.T) {
412415 })
413416
414417 t .Run ("ReplacePath" , func (t * testing.T ) {
415- rootPath := filepath .Dir ("" )
416- expected := []string {
417- filepath .FromSlash (fixPath ("/another/path" , absolutePrefix (rootPath ))),
418- }
419- profile := testProfile (t , Version01 , `path = "/another/path"` )
418+ expected := []string {"relative/custom/path" , "." }
419+ profile := testProfile (t , Version01 , `path = ["relative/custom/path", "."]` )
420420 assert .Equal (t , expected , pathFlag (t , profile ))
421421 })
422422
0 commit comments