Exemple #1
0
func (s *systemSSHKeySuite) TestIdempotent(c *gc.C) {
	err := upgrades.EnsureSystemSSHKey(s.ctx)
	c.Assert(err, jc.ErrorIsNil)

	privateKey, err := ioutil.ReadFile(s.keyFile())
	c.Assert(err, jc.ErrorIsNil)

	err = upgrades.EnsureSystemSSHKey(s.ctx)
	c.Assert(err, jc.ErrorIsNil)

	// Ensure we haven't generated the key again a second time.
	privateKey2, err := ioutil.ReadFile(s.keyFile())
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(privateKey, gc.DeepEquals, privateKey2)
}
Exemple #2
0
func (s *systemSSHKeySuite) TestSystemKeyCreated(c *gc.C) {
	err := upgrades.EnsureSystemSSHKey(s.ctx)
	c.Assert(err, jc.ErrorIsNil)
	pk := s.assertKeyCreation(c)
	s.assertHasPublicKeyInAuth(c, pk)
}
Exemple #3
0
func (s *systemSSHKeySuite) TestSystemKeyCreated(c *gc.C) {
	err := upgrades.EnsureSystemSSHKey(s.ctx)
	c.Assert(err, gc.IsNil)
	s.assertKeyCreation(c)
}