1
0
mirror of https://github.com/rancher/os.git synced 2025-06-25 14:31:33 +00:00
os/tests/cloud_config_install_test.go
Sven Dowideit bd857716a3 Add a cloud-config based install test
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-05-26 15:17:39 +10:00

40 lines
1.3 KiB
Go

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")
}