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

	privateKey, err := ioutil.ReadFile(s.keyFile())
	c.Assert(err, gc.IsNil)

	err = upgrades.EnsureSystemSSHKey(s.ctx)
	c.Assert(err, gc.IsNil)

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