Skip to content

Commit c570fbe

Browse files
author
Mrunal Patel
authored
Merge pull request #282 from Mashimiao/runtime-test-fix-mount-exist-validation
runtimetest: clean filepath for mounts
2 parents ef0496f + 6357f26 commit c570fbe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/runtimetest/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,15 @@ func validateGIDMappings(spec *rspec.Spec) error {
494494
}
495495

496496
func mountMatch(specMount rspec.Mount, sysMount rspec.Mount) error {
497-
if specMount.Destination != sysMount.Destination {
497+
if filepath.Clean(specMount.Destination) != sysMount.Destination {
498498
return fmt.Errorf("mount destination expected: %v, actual: %v", specMount.Destination, sysMount.Destination)
499499
}
500500

501501
if specMount.Type != sysMount.Type {
502502
return fmt.Errorf("mount %v type expected: %v, actual: %v", specMount.Destination, specMount.Type, sysMount.Type)
503503
}
504504

505-
if specMount.Source != sysMount.Source {
505+
if filepath.Clean(specMount.Source) != sysMount.Source {
506506
return fmt.Errorf("mount %v source expected: %v, actual: %v", specMount.Destination, specMount.Source, sysMount.Source)
507507
}
508508

@@ -529,7 +529,7 @@ func validateMountsExist(spec *rspec.Spec) error {
529529

530530
for _, specMount := range spec.Mounts {
531531
found := false
532-
for _, sysMount := range mountsMap[specMount.Destination] {
532+
for _, sysMount := range mountsMap[filepath.Clean(specMount.Destination)] {
533533
if err := mountMatch(specMount, sysMount); err == nil {
534534
found = true
535535
break

0 commit comments

Comments
 (0)