@@ -200,6 +200,20 @@ class RunCommandTest {
200200 ) {
201201 " Command output should match in full"
202202 }
203+
204+ command.bindMount {
205+ from = " from"
206+ target = " target"
207+ }
208+
209+ assert (
210+ command.toString() ==
211+ " RUN --mount=type=bind,from=from,target=target,source=from " +
212+ " \\\n\t " +
213+ " one two"
214+ ) {
215+ " Command output should match in full"
216+ }
203217 }
204218
205219 @Test
@@ -234,6 +248,26 @@ class RunCommandTest {
234248 ) {
235249 " Command output should match in full"
236250 }
251+
252+ command.cacheMount {
253+ from = " from"
254+ target = " target"
255+
256+ gid = 1000
257+ mode = " 0777"
258+ readOnly = true
259+ sharing = RunCommand .MountBuilder .Cache .Sharing .Locked
260+ uid = 1000
261+ }
262+
263+ assert (
264+ command.toString() ==
265+ " RUN --mount=type=cache,id=target,target=target,ro=true,sharing=locked,from=from,mode=0777,uid=1000,gid=1000 " +
266+ " \\\n\t " +
267+ " one two"
268+ ) {
269+ " Command output should match in full"
270+ }
237271 }
238272
239273 @Test
@@ -290,6 +324,21 @@ class RunCommandTest {
290324 ) {
291325 " Command output should match in full"
292326 }
327+
328+ command.secretMount {
329+ gid = 1000
330+ mode = " 0420"
331+ uid = 1000
332+ }
333+
334+ assert (
335+ command.toString() ==
336+ " RUN --mount=type=secret,mode=0420,uid=1000,gid=1000 " +
337+ " \\\n\t " +
338+ " one two"
339+ ) {
340+ " Command output should match in full"
341+ }
293342 }
294343
295344 @Test
@@ -321,19 +370,34 @@ class RunCommandTest {
321370 ) {
322371 " Command output should match in full"
323372 }
373+
374+ command.sshMount {
375+ target = " target"
376+
377+ gid = 1000
378+ id = " id"
379+ mode = " 0620"
380+ uid = 1000
381+ }
382+
383+ assert (
384+ command.toString() ==
385+ " RUN --mount=type=ssh,id=id,target=target,mode=0620,uid=1000,gid=1000 " +
386+ " \\\n\t " +
387+ " one two"
388+ ) {
389+ " Command output should match in full"
390+ }
324391 }
325392
326393 @Test
327394 fun testFull () {
328395 // RUN --mount=type=cache,id=id,target=target,sharing=private,from=from,source=source,mode=0777,uid=1000,gid=1000
329396 // --network=default
330397 // --security=sandbox
331- // <<EOF
332- // one
333- // two
334- // EOF
398+ // [ "one", "two" ]
335399
336- val command = RunCommand .Shell ( " one\n two " )
400+ val command = RunCommand .Exec (arrayOf( " one" , " two " ) )
337401
338402 command.networkType(RunCommand .NetworkType .Default )
339403 command.securityType(RunCommand .SecurityType .Sandbox )
@@ -363,9 +427,7 @@ class RunCommandTest {
363427 " \\\n\t " +
364428 " --security=sandbox " +
365429 " \\\n\t " +
366- " <<EOF\n " +
367- " one\n two\n " +
368- " EOF\n "
430+ " [ \" one\" , \" two\" ]"
369431 ) {
370432 " Command output should match in full"
371433 }
0 commit comments