ssh_key_merge_test.go 600 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package integration
  2. import . "gopkg.in/check.v1"
  3. func (s *QemuSuite) TestSshKeyMerge(c *C) {
  4. s.RunQemu(c)
  5. s.CheckCall(c, `
  6. cat > test-merge << "SCRIPT"
  7. set -x -e
  8. rm /var/lib/rancher/conf/cloud-config.yml
  9. EXISTING=$(ros config get ssh_authorized_keys | head -1)
  10. cat > /var/lib/rancher/conf/metadata << EOF
  11. SSHPublicKeys:
  12. "0": zero
  13. "1": one
  14. "2": two
  15. EOF
  16. ros config set hostname one
  17. ros config set hostname two
  18. ros config set hostname three
  19. cat > expected << EOF
  20. $EXISTING
  21. - zero
  22. - one
  23. - two
  24. EOF
  25. ros config get ssh_authorized_keys > got
  26. diff got expected
  27. SCRIPT
  28. sudo bash test-merge`)
  29. }