@@ -542,6 +542,24 @@ def test_create_with_binds_ro(self):
542
542
inspect_data = self .client .inspect_container (container )
543
543
self .check_container_data (inspect_data , False )
544
544
545
+ def test_create_with_binds_rw_rshared (self ):
546
+ self .run_with_volume_propagation (
547
+ False ,
548
+ 'rshared' ,
549
+ TEST_IMG ,
550
+ ['touch' , os .path .join (self .mount_dest , self .filename )],
551
+ )
552
+ container = self .run_with_volume_propagation (
553
+ True ,
554
+ 'rshared' ,
555
+ TEST_IMG ,
556
+ ['ls' , self .mount_dest ],
557
+ )
558
+ logs = self .client .logs (container ).decode ('utf-8' )
559
+ assert self .filename in logs
560
+ inspect_data = self .client .inspect_container (container )
561
+ self .check_container_data (inspect_data , True , 'rshared' )
562
+
545
563
@requires_api_version ('1.30' )
546
564
def test_create_with_mounts (self ):
547
565
mount = docker .types .Mount (
@@ -597,7 +615,7 @@ def test_create_with_volume_mount(self):
597
615
assert mount ['Source' ] == mount_data ['Name' ]
598
616
assert mount_data ['RW' ] is True
599
617
600
- def check_container_data (self , inspect_data , rw ):
618
+ def check_container_data (self , inspect_data , rw , propagation = 'rprivate' ):
601
619
assert 'Mounts' in inspect_data
602
620
filtered = list (filter (
603
621
lambda x : x ['Destination' ] == self .mount_dest ,
@@ -607,6 +625,7 @@ def check_container_data(self, inspect_data, rw):
607
625
mount_data = filtered [0 ]
608
626
assert mount_data ['Source' ] == self .mount_origin
609
627
assert mount_data ['RW' ] == rw
628
+ assert mount_data ['Propagation' ] == propagation
610
629
611
630
def run_with_volume (self , ro , * args , ** kwargs ):
612
631
return self .run_container (
@@ -624,6 +643,23 @@ def run_with_volume(self, ro, *args, **kwargs):
624
643
** kwargs
625
644
)
626
645
646
+ def run_with_volume_propagation (self , ro , propagation , * args , ** kwargs ):
647
+ return self .run_container (
648
+ * args ,
649
+ volumes = {self .mount_dest : {}},
650
+ host_config = self .client .create_host_config (
651
+ binds = {
652
+ self .mount_origin : {
653
+ 'bind' : self .mount_dest ,
654
+ 'ro' : ro ,
655
+ 'propagation' : propagation
656
+ },
657
+ },
658
+ network_mode = 'none'
659
+ ),
660
+ ** kwargs
661
+ )
662
+
627
663
628
664
class ArchiveTest (BaseAPIIntegrationTest ):
629
665
def test_get_file_archive_from_container (self ):
0 commit comments