network_from_url_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package integration
  2. import . "gopkg.in/check.v1"
  3. func (s *QemuSuite) TestNetworkFromUrl(c *C) {
  4. netArgs := []string{"-net", "nic,vlan=0,model=virtio"}
  5. args := []string{"--append", "rancher.debug=true rancher.password=test-me rancher.cloud_init.datasources=[url:https://gist.githubusercontent.com/joshwget/0bdc616cd26162ad87c535644c8b1ef6/raw/8cce947c08cf006e932b71d92ddbb96bae8e3325/gistfile1.txt]"}
  6. for i := 0; i < 7; i++ {
  7. args = append(args, netArgs...)
  8. }
  9. s.RunQemuWithNetConsole(c, args...)
  10. s.NetCheckCall(c, `
  11. cat > test-merge << "SCRIPT"
  12. set -x -e
  13. ip link show dev br0
  14. ip link show dev br0.100 | grep br0.100@br0
  15. ip link show dev eth1.100 | grep 'master br0'
  16. SCRIPT
  17. sudo bash test-merge`)
  18. s.NetCheckCall(c, `
  19. cat > test-merge << "SCRIPT"
  20. set -x -e
  21. cat /etc/resolv.conf | grep "search mydomain.com example.com"
  22. cat /etc/resolv.conf | grep "nameserver 208.67.222.123"
  23. cat /etc/resolv.conf | grep "nameserver 208.67.220.123"
  24. SCRIPT
  25. sudo bash test-merge`)
  26. }
  27. func (s *QemuSuite) TestNoNetworkCloudConfigFromUrl(c *C) {
  28. args := []string{
  29. "--no-network",
  30. "--append",
  31. "rancher.debug=true rancher.password=test-me rancher.cloud_init.datasources=[url:https://gist.githubusercontent.com/joshwget/0bdc616cd26162ad87c535644c8b1ef6/raw/8cce947c08cf006e932b71d92ddbb96bae8e3325/gistfile1.txt]",
  32. }
  33. s.RunQemuWithNetConsole(c, args...)
  34. s.NetCheckCall(c, "sudo ros config get rancher.log | grep true")
  35. }
  36. func (s *QemuSuite) TestNoNetworkConsoleSwitch(c *C) {
  37. args := []string{
  38. "--no-network",
  39. "--append",
  40. "rancher.debug=true rancher.password=test-me rancher.console=alpine",
  41. }
  42. s.RunQemuWithNetConsole(c, args...)
  43. s.NetCheckCall(c, "uname -a")
  44. }