ros_config_test.go 1.8 KB

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