ros_config_test.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package integration
  2. import . "gopkg.in/check.v1"
  3. func (s *QemuSuite) TestRosConfig(c *C) {
  4. err := s.RunQemu("--cloud-config", "./tests/assets/test_14/cloud-config.yml")
  5. c.Assert(err, IsNil)
  6. s.CheckCall(c, `
  7. set -x -e
  8. if [ "$(sudo ros config get hostname)" == "hostname3
  9. " ]; then
  10. sudo ros config get hostname
  11. exit 1
  12. fi
  13. sudo ros config set hostname rancher-test
  14. if [ "$(sudo ros config get hostname)" == "rancher-test
  15. " ]; then
  16. sudo ros config get hostname
  17. exit 1
  18. fi`)
  19. s.CheckCall(c, `
  20. set -x -e
  21. if [ "$(sudo ros config get rancher.log)" == "true
  22. " ]; then
  23. sudo ros config get rancher.log
  24. exit 1
  25. fi
  26. sudo ros config set rancher.log false
  27. if [ "$(sudo ros config get rancher.log)" == "false
  28. " ]; then
  29. sudo ros config get rancher.log
  30. exit 1
  31. fi
  32. if [ "$(sudo ros config get rancher.debug)" == "false
  33. " ]; then
  34. sudo ros config get rancher.debug
  35. exit 1
  36. fi
  37. sudo ros config set rancher.debug true
  38. if [ "$(sudo ros config get rancher.debug)" == "true
  39. " ]; then
  40. sudo ros config get rancher.debug
  41. exit 1
  42. fi`)
  43. s.CheckCall(c, `
  44. set -x -e
  45. sudo ros config set rancher.network.dns.search '[a,b]'
  46. if [ "$(sudo ros config get rancher.network.dns.search)" == "- a
  47. - b
  48. " ]; then
  49. sudo ros config get rancher.network.dns.search
  50. exit 1
  51. fi
  52. sudo ros config set rancher.network.dns.search '[]'
  53. if [ "$(sudo ros config get rancher.network.dns.search)" == "[]
  54. " ]; then
  55. sudo ros config get rancher.network.dns.search
  56. exit 1
  57. fi`)
  58. s.CheckCall(c, `
  59. set -x -e
  60. if sudo ros config export | grep "PRIVATE KEY"; then
  61. exit 1
  62. fi
  63. sudo ros config export --private | grep "PRIVATE KEY"
  64. sudo ros config export --full | grep "udev"
  65. sudo ros config export --private --full | grep "ntp"
  66. sudo ros config export --full | grep "labels"
  67. sudo ros config export --private --full | grep "PRIVATE KEY"`)
  68. }