Skip to content

Commit

Permalink
fold up: add final test of installed vm booting
Browse files Browse the repository at this point in the history
  • Loading branch information
hallyn committed Oct 3, 2023
1 parent bf4eff9 commit 0564994
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions layers/install/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ demo-target-rootfs:
cp mosctl console-helper /usr/bin
( cd /usr/bin && chmod 755 mosctl console-helper )
systemctl enable debug-shell.service # Danger - don't leave this
systemctl mask serial-getty@ttyS0
echo root:passw0rd | chpasswd
systemctl enable serial-getty@ttyS0
annotations:
org.opencontainers.image.title: demo-target-rootfs
org.opencontainers.image.description: Unsafe demo rootfs to install
Expand Down
40 changes: 39 additions & 1 deletion tests/launch.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ product: default
update_type: complete
targets:
- service_name: hostfs
source: "docker://zothub.io/machine/bootkit/demo-target-rootfs:0.0.1-squashfs"
source: "docker://zothub.io/machine/bootkit/demo-target-rootfs:0.0.3-squashfs"
version: 1.0.0
service_type: hostfs
nsgroup: "none"
Expand All @@ -41,4 +41,42 @@ EOF
--repo 127.0.0.1:${ZOT_PORT} --name machine/install:1.0.0 \
"${TMPD}/manifest.yaml"
trust launch --project=snakeoil:default vm1 10.0.2.2:$ZOT_PORT/machine/install:1.0.0
machine start vm1
expect <<EOF
spawn machine console vm1
set timeout 120
expect {
"localhost login:" { puts "got login prompt" }
timeout {
puts "timed out waiting for login prompt"
exit 1
}
send "root\n"
expect {
"assword" { puts "got password prompt" }
timeout {
puts "timed out waiting for password prompt on final boot"
exit 1
}
}
send "passw0rd\n"
expect {
"bash" { puts "got shell" }
"root@localhost:" { puts "got shell" }
timeout {
puts "timed out waiting for shell on final boot"
exit 1
}
}
send "poweroff -f\n"
expect {
"Power down" { puts "success powering down" }
timeout {
puts "timed out waiting for shutdown on final boot"
exit 1
}
}
}
EOF
echo "launch: success"
}

0 comments on commit 0564994

Please sign in to comment.