@@ -14,6 +14,8 @@ load helpers
14
14
}
15
15
16
16
@test " add-local-plain" {
17
+ skip_if_unable_to_mount
18
+
17
19
createrandom ${TEST_SCRATCH_DIR} /randomfile
18
20
createrandom ${TEST_SCRATCH_DIR} /other-randomfile
19
21
@@ -59,6 +61,8 @@ load helpers
59
61
}
60
62
61
63
@test " add-local-archive" {
64
+ skip_if_unable_to_mount
65
+
62
66
createrandom ${TEST_SCRATCH_DIR} /randomfile
63
67
createrandom ${TEST_SCRATCH_DIR} /other-randomfile
64
68
@@ -201,6 +205,8 @@ load helpers
201
205
}
202
206
203
207
@test " add --ignorefile" {
208
+ skip_if_unable_to_mount
209
+
204
210
mytest=${TEST_SCRATCH_DIR} /mytest
205
211
mkdir -p ${mytest}
206
212
touch ${mytest} /mystuff
@@ -234,6 +240,8 @@ stuff/mystuff"
234
240
}
235
241
236
242
@test " add quietly" {
243
+ skip_if_unable_to_mount
244
+
237
245
_prefetch busybox
238
246
createrandom ${TEST_SCRATCH_DIR} /randomfile
239
247
run_buildah from --quiet $WITH_POLICY_JSON busybox
@@ -246,6 +254,8 @@ stuff/mystuff"
246
254
}
247
255
248
256
@test " add from container" {
257
+ skip_if_unable_to_mount
258
+
249
259
_prefetch busybox
250
260
createrandom ${TEST_SCRATCH_DIR} /randomfile
251
261
run_buildah from --quiet $WITH_POLICY_JSON busybox
@@ -265,6 +275,8 @@ stuff/mystuff"
265
275
}
266
276
267
277
@test " add from image" {
278
+ skip_if_unable_to_mount
279
+
268
280
_prefetch busybox ubuntu
269
281
run_buildah from --quiet $WITH_POLICY_JSON busybox
270
282
cid=$output
@@ -394,26 +406,28 @@ EOF
394
406
}
395
407
396
408
@test " add-link-flag" {
409
+ skip_if_unable_to_mount
410
+
397
411
createrandom ${TEST_SCRATCH_DIR} /randomfile
398
412
createrandom ${TEST_SCRATCH_DIR} /other-randomfile
399
413
400
414
run_buildah from $WITH_POLICY_JSON scratch
401
415
cid=$output
402
416
run_buildah mount $cid
403
417
root=$output
404
-
418
+
405
419
run_buildah config --workingdir=/ $cid
406
-
420
+
407
421
# Test 1: Simple add
408
422
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /randomfile
409
-
423
+
410
424
# Test 2: Add with rename (file to file with different name)
411
425
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /randomfile /renamed-file
412
-
426
+
413
427
# Test 3: Multiple files to directory
414
428
mkdir $root /subdir
415
429
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /randomfile ${TEST_SCRATCH_DIR} /other-randomfile /subdir
416
-
430
+
417
431
run_buildah unmount $cid
418
432
run_buildah commit $WITH_POLICY_JSON $cid add-link-image
419
433
@@ -430,34 +444,36 @@ EOF
430
444
newcid=$output
431
445
run_buildah mount $newcid
432
446
newroot=$output
433
-
447
+
434
448
test -s $newroot /randomfile
435
449
cmp ${TEST_SCRATCH_DIR} /randomfile $newroot /randomfile
436
-
450
+
437
451
test -s $newroot /renamed-file
438
452
cmp ${TEST_SCRATCH_DIR} /randomfile $newroot /renamed-file
439
-
453
+
440
454
test -s $newroot /subdir/randomfile
441
455
cmp ${TEST_SCRATCH_DIR} /randomfile $newroot /subdir/randomfile
442
456
test -s $newroot /subdir/other-randomfile
443
457
cmp ${TEST_SCRATCH_DIR} /other-randomfile $newroot /subdir/other-randomfile
444
458
}
445
459
446
460
@test " add-link-archive" {
461
+ skip_if_unable_to_mount
462
+
447
463
createrandom ${TEST_SCRATCH_DIR} /file1
448
464
createrandom ${TEST_SCRATCH_DIR} /file2
449
-
465
+
450
466
tar -c -C ${TEST_SCRATCH_DIR} -f ${TEST_SCRATCH_DIR} /archive.tar file1 file2
451
467
452
468
run_buildah from $WITH_POLICY_JSON scratch
453
469
cid=$output
454
-
470
+
455
471
run_buildah config --workingdir=/ $cid
456
-
472
+
457
473
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /archive.tar
458
-
474
+
459
475
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /archive.tar /destdir/
460
-
476
+
461
477
run_buildah commit $WITH_POLICY_JSON $cid add-link-archive-image
462
478
463
479
run_buildah inspect --type=image add-link-archive-image
@@ -471,41 +487,43 @@ EOF
471
487
newcid=$output
472
488
run_buildah mount $newcid
473
489
newroot=$output
474
-
490
+
475
491
test -s $newroot /file1
476
492
cmp ${TEST_SCRATCH_DIR} /file1 $newroot /file1
477
493
test -s $newroot /file2
478
494
cmp ${TEST_SCRATCH_DIR} /file2 $newroot /file2
479
-
495
+
480
496
test -s $newroot /destdir/file1
481
497
cmp ${TEST_SCRATCH_DIR} /file1 $newroot /destdir/file1
482
498
test -s $newroot /destdir/file2
483
499
cmp ${TEST_SCRATCH_DIR} /file2 $newroot /destdir/file2
484
500
}
485
501
486
502
@test " add-link-directory" {
503
+ skip_if_unable_to_mount
504
+
487
505
mkdir -p ${TEST_SCRATCH_DIR} /testdir/subdir
488
506
createrandom ${TEST_SCRATCH_DIR} /testdir/file1
489
507
createrandom ${TEST_SCRATCH_DIR} /testdir/subdir/file2
490
508
491
509
run_buildah from $WITH_POLICY_JSON scratch
492
510
cid=$output
493
-
511
+
494
512
run_buildah config --workingdir=/ $cid
495
-
513
+
496
514
run_buildah add --link $cid ${TEST_SCRATCH_DIR} /testdir /testdir
497
-
515
+
498
516
run_buildah commit $WITH_POLICY_JSON $cid add-link-dir-image
499
517
500
518
run_buildah from $WITH_POLICY_JSON add-link-dir-image
501
519
newcid=$output
502
520
run_buildah mount $newcid
503
521
newroot=$output
504
-
522
+
505
523
test -d $newroot /testdir
506
524
test -s $newroot /testdir/file1
507
525
test -s $newroot /testdir/subdir/file2
508
-
526
+
509
527
cmp ${TEST_SCRATCH_DIR} /testdir/file1 $newroot /testdir/file1
510
528
cmp ${TEST_SCRATCH_DIR} /testdir/subdir/file2 $newroot /testdir/subdir/file2
511
529
}
0 commit comments