installer_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package integration
  2. import (
  3. "fmt"
  4. "time"
  5. . "gopkg.in/check.v1"
  6. )
  7. func (s *QemuSuite) TestInstallMsDosMbr(c *C) {
  8. // test_17 cloud config is an invalid http proxy cfg, so the installer has no network
  9. runArgs := []string{
  10. "--iso",
  11. "--fresh",
  12. "--cloud-config",
  13. "./tests/assets/test_17/cloud-config.yml",
  14. }
  15. version := ""
  16. {
  17. s.RunQemuWith(c, runArgs...)
  18. version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
  19. fmt.Printf("installing %s", version)
  20. s.CheckCall(c, `
  21. echo "---------------------------------- generic"
  22. set -ex
  23. sudo parted /dev/vda print
  24. echo "ssh_authorized_keys:" > config.yml
  25. echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
  26. sudo ros install --force --no-reboot --device /dev/vda -c config.yml --append rancher.password=rancher
  27. sync
  28. `)
  29. time.Sleep(500 * time.Millisecond)
  30. s.Stop(c)
  31. }
  32. // ./scripts/run --no-format --append "rancher.debug=true"
  33. runArgs = []string{
  34. "--boothd",
  35. }
  36. s.RunQemuWith(c, runArgs...)
  37. s.CheckOutput(c, version, Equals, "sudo ros -v")
  38. s.Stop(c)
  39. }
  40. func (s *QemuSuite) TestInstallGptMbr(c *C) {
  41. // ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
  42. runArgs := []string{
  43. "--iso",
  44. "--fresh",
  45. }
  46. version := ""
  47. {
  48. s.RunQemuWith(c, runArgs...)
  49. version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
  50. fmt.Printf("installing %s", version)
  51. s.CheckCall(c, `
  52. echo "---------------------------------- gptsyslinux"
  53. set -ex
  54. sudo parted /dev/vda print
  55. echo "ssh_authorized_keys:" > config.yml
  56. echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
  57. sudo ros install --force --no-reboot --device /dev/vda -t gptsyslinux -c config.yml
  58. sync
  59. `)
  60. time.Sleep(500 * time.Millisecond)
  61. s.Stop(c)
  62. }
  63. // ./scripts/run --no-format --append "rancher.debug=true"
  64. runArgs = []string{
  65. "--boothd",
  66. }
  67. s.RunQemuWith(c, runArgs...)
  68. s.CheckOutput(c, version, Equals, "sudo ros -v")
  69. // TEST parted output? (gpt non-uefi == legacy_boot)
  70. s.Stop(c)
  71. }
  72. func (s *QemuSuite) TestInstallAlpine(c *C) {
  73. // ./scripts/run --no-format --append "rancher.debug=true" --iso --fresh
  74. runArgs := []string{
  75. "--iso",
  76. "--fresh",
  77. }
  78. version := ""
  79. {
  80. s.RunQemuWith(c, runArgs...)
  81. s.MakeCall("sudo ros console switch -f alpine")
  82. c.Assert(s.WaitForSSH(), IsNil)
  83. version = s.CheckOutput(c, version, Not(Equals), "sudo ros -v")
  84. fmt.Printf("installing %s", version)
  85. s.CheckCall(c, `
  86. set -ex
  87. echo "ssh_authorized_keys:" > config.yml
  88. echo " - $(cat /home/rancher/.ssh/authorized_keys)" >> config.yml
  89. sudo ros install --force --no-reboot --device /dev/vda -c config.yml
  90. sync
  91. `)
  92. time.Sleep(500 * time.Millisecond)
  93. s.Stop(c)
  94. }
  95. // ./scripts/run --no-format --append "rancher.debug=true"
  96. runArgs = []string{
  97. "--boothd",
  98. }
  99. s.RunQemuWith(c, runArgs...)
  100. s.CheckOutput(c, version, Equals, "sudo ros -v")
  101. s.Stop(c)
  102. }