Release new version 0.108
[grml-debootstrap.git] / docker / test_vminstall.bats
1 #!/usr/bin/env bats
2
3 mountpath="/mnt"
4 image="/srv/debian.img"
5
6 setup() {
7   if ! mountpoint "${mountpath}" &>/dev/null ; then
8     partition="$(kpartx -asv ${image} | awk '/add/ {print $3}')"
9     mount "/dev/mapper/${partition}" "${mountpath}"
10   fi
11 }
12
13 teardown() {
14   if mountpoint "${mountpath}" &>/dev/null ; then
15     umount "${mountpath}"
16     kpartx -vd "${image}"
17   fi
18 }
19
20 @test "ensure grub configuration is present" {
21   run ls "${mountpath}"/boot/grub/grub.cfg
22   [ "$status" -eq 0 ]
23 }
24
25 @test "ensure eatmydata package is present" {
26   run chroot "${mountpath}" dpkg --list eatmydata
27   [ "$status" -eq 0 ]
28 }
29
30 @test "kernel is present" {
31   run ls "${mountpath}"/boot/vmlinuz-*
32   [ "$status" -eq 0 ]
33 }
34
35 @test "debian_version exists and is valid version" {
36   run cat "${mountpath}/etc/debian_version"
37   [ "$status" -eq 0 ]
38   [[ "$output" == [0-9].[0-9]* ]] || [[ "$output" == 'stretch/sid' ]]
39 }