@@ -3,6 +3,7 @@ package tests
33import  (
44	"fmt" 
55	"os" 
6+ 	"path/filepath" 
67	"strings" 
78	"testing" 
89
@@ -23,6 +24,7 @@ var createTests = []func(t *testing.T, sb integration.Sandbox){
2324	testCreateMemoryLimit ,
2425	testCreateRestartAlways ,
2526	testCreateRemoteContainer ,
27+ 	testCreateMount ,
2628}
2729
2830func  testCreateMemoryLimit (t  * testing.T , sb  integration.Sandbox ) {
@@ -108,3 +110,31 @@ func testCreateRemoteContainer(t *testing.T, sb integration.Sandbox) {
108110	}
109111	require .Fail (t , "remote builder is not running" )
110112}
113+ 
114+ func  testCreateMount (t  * testing.T , sb  integration.Sandbox ) {
115+ 	if  ! isDockerContainerWorker (sb ) {
116+ 		t .Skip ("only testing with docker-container worker" )
117+ 	}
118+ 
119+ 	var  builderName  string 
120+ 	t .Cleanup (func () {
121+ 		if  builderName  ==  ""  {
122+ 			return 
123+ 		}
124+ 		out , err  :=  rmCmd (sb , withArgs (builderName ))
125+ 		require .NoError (t , err , out )
126+ 	})
127+ 
128+ 	d , err  :=  filepath .Abs (t .TempDir ())
129+ 	require .NoError (t , err )
130+ 
131+ 	f  :=  filepath .Join (d , "test.json" )
132+ 	require .NoError (t , os .WriteFile (f , []byte (`{"test":{"foo":"bar"}}` ), 0644 ))
133+ 
134+ 	out , err  :=  createCmd (sb , withArgs ("--driver" , "docker-container" , "--driver-opt" , fmt .Sprintf (`mount.%s=/etc/buildkit/provenance.d/test.json` , f )))
135+ 	require .NoError (t , err , out )
136+ 	builderName  =  strings .TrimSpace (out )
137+ 
138+ 	out , err  =  inspectCmd (sb , withArgs (builderName , "--bootstrap" ))
139+ 	require .NoError (t , err , out )
140+ }
0 commit comments