ssh_key_merge_test.go 629 B

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