mirror of
https://github.com/rancher/os.git
synced 2025-06-25 14:31:33 +00:00
Add a cloud-config based install test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
parent
85c8916f4e
commit
bd857716a3
@ -255,7 +255,7 @@ if [ "$CONSOLEDISPLAY" == "1" ]; then
|
||||
DISPLAY_OPTS="-curses"
|
||||
else
|
||||
# default
|
||||
DISPLAY_OPTS="-nographic -serial stdio -display none"
|
||||
DISPLAY_OPTS="-nographic -serial mon:stdio -display none"
|
||||
fi
|
||||
|
||||
if [ "$QEMU" == "1" ]; then
|
||||
|
27
tests/assets/cloud_config_install_test/cloud-config.yml
Normal file
27
tests/assets/cloud_config_install_test/cloud-config.yml
Normal file
@ -0,0 +1,27 @@
|
||||
#cloud-config
|
||||
write_files:
|
||||
- path: /opt/install
|
||||
permissions: "0755"
|
||||
content: |
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
echo "running" > /var/log/ros-install.log
|
||||
system-docker exec console ros install -i rancher/os:v1.0.1 -d /dev/vda --append "rancher.password=rancher" -f --no-reboot --debug >> /var/log/install.log 2>&1
|
||||
echo "done" > /var/log/ros-install.log
|
||||
ssh_authorized_keys:
|
||||
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF
|
||||
rancher:
|
||||
services:
|
||||
ros-install:
|
||||
image: alpine
|
||||
entrypoint: /usr/bin/ros entrypoint
|
||||
command: /opt/install
|
||||
labels:
|
||||
io.rancher.os.scope: system
|
||||
io.rancher.os.after: console
|
||||
uts: host
|
||||
privileged: true
|
||||
volumes:
|
||||
- /var/log:/var/log
|
||||
volumes_from:
|
||||
- all-volumes
|
39
tests/cloud_config_install_test.go
Normal file
39
tests/cloud_config_install_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func (s *QemuSuite) TestCloudConfigInstall(c *C) {
|
||||
s.RunQemu(c,
|
||||
"--iso",
|
||||
"--fresh",
|
||||
"--no-format",
|
||||
"--cloud-config", "./tests/assets/cloud_config_install_test/cloud-config.yml")
|
||||
|
||||
//check we have a particular version, from iso
|
||||
s.CheckOutput(c, " Backing Filesystem: tmpfs\n", Equals, "sudo system-docker info | grep Filesystem")
|
||||
//and no persistence yet
|
||||
//s.CheckOutput(c, "\n", Equals, "sudo blkid")
|
||||
// TODO: need some way to wait for install to complete.
|
||||
time.Sleep(time.Second)
|
||||
for {
|
||||
result, _ := s.MakeCall("cat", "/var/log/ros-install.log")
|
||||
if result == "done\n" {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Second * 3)
|
||||
}
|
||||
//check we have persistence and that ros-install completed ok
|
||||
s.CheckOutput(c, "/dev/vda1:\n", Equals, "sudo blkid | grep RANCHER_STATE | cut -d ' ' -f 1")
|
||||
s.CheckOutput(c, "LABEL=\"RANCHER_STATE\"\n", Equals, "sudo blkid | grep vda1 | cut -d ' ' -f 2")
|
||||
|
||||
//reboot, and check we're using the new non-iso install
|
||||
s.Stop(c)
|
||||
s.RunQemuWith(c, "--qemu", "--boothd", "--no-rm-usr")
|
||||
s.CheckOutput(c, "/dev/vda1:\n", Equals, "sudo blkid | grep RANCHER_STATE | cut -d ' ' -f 1")
|
||||
s.CheckOutput(c, "LABEL=\"RANCHER_STATE\"\n", Equals, "sudo blkid | grep vda1 | cut -d ' ' -f 2")
|
||||
s.CheckOutput(c, " Backing Filesystem: extfs\n", Equals, "sudo system-docker info | grep Filesystem")
|
||||
}
|
Loading…
Reference in New Issue
Block a user