@@ -308,7 +308,8 @@ func TestContainerSpecWithExtraMounts(t *testing.T) {
308308 config , sandboxConfig , imageConfig , specCheck := getCreateContainerTestData ()
309309 c := newTestCRIService ()
310310 mountInConfig := & runtime.Mount {
311- ContainerPath : "test-container-path" ,
311+ // Test cleanpath
312+ ContainerPath : "test-container-path/" ,
312313 HostPath : "test-host-path" ,
313314 Readonly : false ,
314315 }
@@ -335,7 +336,7 @@ func TestContainerSpecWithExtraMounts(t *testing.T) {
335336 specCheck (t , testID , testSandboxID , testPid , spec )
336337 var mounts , sysMounts , devMounts []runtimespec.Mount
337338 for _ , m := range spec .Mounts {
338- if m .Destination == "test-container-path" {
339+ if strings . HasPrefix ( m .Destination , "test-container-path" ) {
339340 mounts = append (mounts , m )
340341 } else if m .Destination == "/sys" {
341342 sysMounts = append (sysMounts , m )
@@ -498,6 +499,21 @@ func TestGenerateVolumeMounts(t *testing.T) {
498499 "/test-volume-2" ,
499500 },
500501 },
502+ "should compare and return cleanpath" : {
503+ criMounts : []* runtime.Mount {
504+ {
505+ ContainerPath : "/test-volume-1" ,
506+ HostPath : "/test-hostpath-1" ,
507+ },
508+ },
509+ imageVolumes : map [string ]struct {}{
510+ "/test-volume-1/" : {},
511+ "/test-volume-2/" : {},
512+ },
513+ expectedMountDest : []string {
514+ "/test-volume-2/" ,
515+ },
516+ },
501517 } {
502518 t .Logf ("TestCase %q" , desc )
503519 config := & imagespec.ImageConfig {
0 commit comments