func (s *initialisationSuite) TestInitUbuntuUserExisting(c *gc.C) { defer installFakeSSH(c, "", nil, 0)() manual.InitUbuntuUser("testhost", "testuser", "", nil, nil) }
func (s *initialisationSuite) TestInitUbuntuUserError(c *gc.C) { defer installFakeSSH(c, "", []string{"", "failed to create ubuntu user"}, 123)() defer installFakeSSH(c, "", "", 1)() // simulate failure of ubuntu@ login err := manual.InitUbuntuUser("testhost", "testuser", "", nil, nil) c.Assert(err, gc.ErrorMatches, "subprocess encountered error code 123 \\(failed to create ubuntu user\\)") }
func (s *initialisationSuite) TestInitUbuntuUserNonExisting(c *gc.C) { defer installFakeSSH(c, "", "", 0)() // successful creation of ubuntu user defer installFakeSSH(c, "", "", 1)() // simulate failure of ubuntu@ login err := manual.InitUbuntuUser("testhost", "testuser", "", nil, nil) c.Assert(err, jc.ErrorIsNil) }