コード例 #1
0
ファイル: service_test.go プロジェクト: pombredanne/snappy-1
func (s *serviceSuite) TestServiceMustBeStartedAfterReboot(c *check.C) {
	if common.BeforeReboot() {
		installSnapWithService(c)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		c.Assert(isServiceRunning(c), check.Equals, true, check.Commentf("Service is not running"))
	}
}
コード例 #2
0
ファイル: rollback_test.go プロジェクト: pombredanne/snappy-1
func (s *rollbackSuite) TestRollbackMustRebootToOtherVersion(c *check.C) {
	if common.BeforeReboot() {
		common.CallFakeUpdate(c)
		common.Reboot(c)
	} else if common.CheckRebootMark(c.TestName()) {
		common.RemoveRebootMark(c)
		currentVersion := common.GetCurrentUbuntuCoreVersion(c)
		c.Assert(currentVersion > common.GetSavedVersion(c), check.Equals, true,
			check.Commentf("Rebooted to the wrong version: %d", currentVersion))
		cli.ExecCommand(c, "sudo", "snappy", "rollback", "ubuntu-core",
			strconv.Itoa(common.GetSavedVersion(c)))
		common.SetSavedVersion(c, currentVersion)
		common.RebootWithMark(c, c.TestName()+"-rollback")
	} else if common.CheckRebootMark(c.TestName() + "-rollback") {
		common.RemoveRebootMark(c)
		currentVersion := common.GetCurrentUbuntuCoreVersion(c)
		c.Assert(currentVersion < common.GetSavedVersion(c), check.Equals, true,
			check.Commentf("Rebooted to the wrong version: %d", currentVersion))
	}
}
コード例 #3
0
func (s *initRAMFSSuite) TestFreeSpaceWithResize(c *check.C) {
	if common.BeforeReboot() {
		bootDir := getCurrentBootDir(c)
		writablePercent := "85"
		cli.ExecCommand(
			c, "sh", "-x", "_integration-tests/scripts/install-test-initramfs", bootDir, writablePercent)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		freeSpace := getFreeSpacePercent(c)
		c.Assert(freeSpace < 10, check.Equals, true,
			check.Commentf("The writable partition was not resized"))
	}
}
コード例 #4
0
ファイル: update_test.go プロジェクト: pombredanne/snappy-1
// Test that the update to the same release and channel must install a newer
// version. If there is no update available, the channel version will be
// modified to fake an update. If there is a version available, the image will
// be up-to-date after running this test.
func (s *updateSuite) TestUpdateToSameReleaseAndChannel(c *check.C) {
	if common.BeforeReboot() {
		updateOutput := common.CallFakeUpdate(c)
		expected := "(?ms)" +
			".*" +
			"^Reboot to use .*ubuntu-core.\n"
		c.Assert(updateOutput, check.Matches, expected)
		s.assertBootDirContents(c)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		c.Assert(common.GetCurrentUbuntuCoreVersion(c) > common.GetSavedVersion(c),
			check.Equals, true)
	}
}
コード例 #5
0
ファイル: failover_test.go プロジェクト: pombredanne/snappy-1
// This is the logic common to all the failover tests. Each of them has define a
// type implementing the failer interface and call this function with an instance
// of it
func commonFailoverTest(c *check.C, f failer) {
	currentVersion := common.GetCurrentUbuntuCoreVersion(c)

	if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		f.unset(c)
		c.Assert(common.GetSavedVersion(c), check.Equals, currentVersion,
			check.Commentf("Rebooted to the wrong version"))
	} else {
		common.SetSavedVersion(c, currentVersion-1)
		common.CallFakeUpdate(c)
		f.set(c)
		common.Reboot(c)
	}
}