File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ func (c *ContainerRequest) validateMounts() error {
532532 if len (hostConfig .Binds ) > 0 {
533533 for _ , bind := range hostConfig .Binds {
534534 parts := strings .Split (bind , ":" )
535- if len (parts ) != 2 {
535+ if len (parts ) != 2 && len ( parts ) != 3 {
536536 return fmt .Errorf ("%w: %s" , ErrInvalidBindMount , bind )
537537 }
538538 targetPath := parts [1 ]
Original file line number Diff line number Diff line change @@ -73,11 +73,33 @@ func Test_ContainerValidation(t *testing.T) {
7373 },
7474 {
7575 Name : "Invalid bind mount" ,
76- ExpectedError : "invalid bind mount: /data:/data:/data " ,
76+ ExpectedError : "invalid bind mount: /data:/data:a:b " ,
7777 ContainerRequest : testcontainers.ContainerRequest {
7878 Image : "redis:latest" ,
7979 HostConfigModifier : func (hc * container.HostConfig ) {
80- hc .Binds = []string {"/data:/data:/data" }
80+ hc .Binds = []string {"/data:/data:a:b" }
81+ },
82+ },
83+ },
84+ {
85+ Name : "bind-options/provided" ,
86+ ContainerRequest : testcontainers.ContainerRequest {
87+ Image : "redis:latest" ,
88+ HostConfigModifier : func (hc * container.HostConfig ) {
89+ hc .Binds = []string {
90+ "/a:/a:nocopy" ,
91+ "/b:/b:ro" ,
92+ "/c:/c:rw" ,
93+ "/d:/d:z" ,
94+ "/e:/e:Z" ,
95+ "/f:/f:shared" ,
96+ "/g:/g:rshared" ,
97+ "/h:/h:slave" ,
98+ "/i:/i:rslave" ,
99+ "/j:/j:private" ,
100+ "/k:/k:rprivate" ,
101+ "/l:/l:ro,z,shared" ,
102+ }
81103 },
82104 },
83105 },
You can’t perform that action at this time.
0 commit comments