2016-12-15 13:15:49 +00:00
|
|
|
package integration
|
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
import (
|
2016-12-22 05:42:44 +00:00
|
|
|
"fmt"
|
2017-06-02 00:33:47 +00:00
|
|
|
"strings"
|
2016-12-20 12:49:34 +00:00
|
|
|
"time"
|
2016-12-15 13:15:49 +00:00
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
. "gopkg.in/check.v1"
|
|
|
|
)
|
2016-12-15 13:15:49 +00:00
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
func (s *QemuSuite) TestInstallMsDosMbr(c *C) {
|
2017-01-17 12:13:35 +00:00
|
|
|
// test_17 cloud config is an invalid http proxy cfg, so the installer has no network
|
2016-12-15 13:15:49 +00:00
|
|
|
runArgs := []string{
|
|
|
|
"--iso",
|
|
|
|
"--fresh",
|
2017-01-17 12:13:35 +00:00
|
|
|
"--cloud-config",
|
|
|
|
"./tests/assets/test_17/cloud-config.yml",
|
2016-12-15 13:15:49 +00:00
|
|
|
}
|
2016-12-22 05:42:44 +00:00
|
|
|
version := ""
|
2016-12-15 13:15:49 +00:00
|
|
|
{
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
2016-12-22 05:42:44 +00:00
|
|
|
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
|
|
|
fmt.Printf("installing %s", version)
|
2016-12-15 13:15:49 +00:00
|
|
|
|
|
|
|
s.CheckCall(c, `
|
|
|
|
echo "---------------------------------- generic"
|
|
|
|
set -ex
|
|
|
|
sudo parted /dev/vda print
|
|
|
|
echo "ssh_authorized_keys:" > config.yml
|
|
|
|
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
2016-12-20 12:49:34 +00:00
|
|
|
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append rancher.password=rancher
|
|
|
|
sync
|
|
|
|
`)
|
|
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
s.Stop(c)
|
2016-12-15 13:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true"
|
|
|
|
runArgs = []string{
|
|
|
|
"--boothd",
|
|
|
|
}
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
2016-12-22 05:42:44 +00:00
|
|
|
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
2016-12-20 12:49:34 +00:00
|
|
|
s.Stop(c)
|
|
|
|
}
|
2016-12-15 13:15:49 +00:00
|
|
|
|
2016-12-20 12:49:34 +00:00
|
|
|
func (s *QemuSuite) TestInstallGptMbr(c *C) {
|
2016-12-15 13:15:49 +00:00
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
|
2016-12-20 12:49:34 +00:00
|
|
|
runArgs := []string{
|
2016-12-15 13:15:49 +00:00
|
|
|
"--iso",
|
|
|
|
"--fresh",
|
|
|
|
}
|
2016-12-22 05:42:44 +00:00
|
|
|
version := ""
|
2016-12-15 13:15:49 +00:00
|
|
|
{
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
2016-12-20 12:49:34 +00:00
|
|
|
|
2016-12-22 05:42:44 +00:00
|
|
|
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
|
|
|
fmt.Printf("installing %s", version)
|
2016-12-15 13:15:49 +00:00
|
|
|
|
|
|
|
s.CheckCall(c, `
|
|
|
|
echo "---------------------------------- gptsyslinux"
|
|
|
|
set -ex
|
|
|
|
sudo parted /dev/vda print
|
|
|
|
echo "ssh_authorized_keys:" > config.yml
|
|
|
|
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
2016-12-20 12:49:34 +00:00
|
|
|
sudo ros install --force --no-reboot --device /dev/vda -t gptsyslinux -c config.yml
|
|
|
|
sync
|
|
|
|
`)
|
|
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
s.Stop(c)
|
2016-12-15 13:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true"
|
|
|
|
runArgs = []string{
|
|
|
|
"--boothd",
|
|
|
|
}
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
2016-12-22 05:42:44 +00:00
|
|
|
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
2016-12-15 13:15:49 +00:00
|
|
|
// TEST parted output? (gpt non-uefi == legacy_boot)
|
2016-12-20 12:49:34 +00:00
|
|
|
s.Stop(c)
|
|
|
|
}
|
2017-03-23 01:31:35 +00:00
|
|
|
|
|
|
|
func (s *QemuSuite) TestInstallAlpine(c *C) {
|
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
|
|
|
|
runArgs := []string{
|
|
|
|
"--iso",
|
|
|
|
"--fresh",
|
|
|
|
}
|
|
|
|
version := ""
|
|
|
|
{
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
|
|
|
s.MakeCall("sudo ros console switch -f alpine")
|
|
|
|
c.Assert(s.WaitForSSH(), IsNil)
|
|
|
|
|
|
|
|
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
|
|
|
fmt.Printf("installing %s", version)
|
|
|
|
|
|
|
|
s.CheckCall(c, `
|
|
|
|
set -ex
|
|
|
|
echo "ssh_authorized_keys:" > config.yml
|
|
|
|
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
|
|
|
sudo ros install --force --no-reboot --device /dev/vda -c config.yml
|
|
|
|
sync
|
|
|
|
`)
|
|
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
s.Stop(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true"
|
|
|
|
runArgs = []string{
|
|
|
|
"--boothd",
|
|
|
|
}
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
|
|
|
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
|
|
|
s.Stop(c)
|
|
|
|
}
|
2017-06-02 00:33:47 +00:00
|
|
|
|
|
|
|
func (s *QemuSuite) TestAutoResize(c *C) {
|
|
|
|
runArgs := []string{
|
|
|
|
"--iso",
|
|
|
|
"--fresh",
|
|
|
|
}
|
|
|
|
version := ""
|
|
|
|
disk := "/dev/vda1\n"
|
|
|
|
size := ""
|
|
|
|
{
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
|
|
|
version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
|
|
|
|
fmt.Printf("installing %s", version)
|
|
|
|
|
|
|
|
s.CheckCall(c, `
|
|
|
|
set -ex
|
|
|
|
echo "ssh_authorized_keys:" > config.yml
|
|
|
|
echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
|
|
|
|
sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append "rancher.resize_device=/dev/vda"
|
|
|
|
sync
|
|
|
|
`)
|
|
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
s.CheckCall(c, "sudo mount "+strings.TrimSpace(disk)+" /mnt")
|
|
|
|
size = s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
|
|
|
|
s.Stop(c)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ./scripts/run --no-format --append "rancher.debug=true"
|
|
|
|
runArgs = []string{
|
|
|
|
"--boothd",
|
|
|
|
"--resizehd", "+20G",
|
|
|
|
}
|
|
|
|
s.RunQemuWith(c, runArgs...)
|
|
|
|
|
|
|
|
s.CheckOutput(c, version, Equals, "sudo ros -v")
|
|
|
|
s.CheckOutput(c, disk, Equals, "blkid | cut -f 1 -d ' ' | sed 's/://'")
|
|
|
|
s.CheckOutput(c, size, Not(Equals), "df -h | grep "+strings.TrimSpace(disk)+" | head -n1 | sed 's/ \\+/;/g' | cut -d ';' -f 2")
|
|
|
|
|
|
|
|
s.Stop(c)
|
|
|
|
}
|