示例#1
0
func (s *updateAppSuite) TestAppUpdate(c *check.C) {
	snap := "hello-world.canonical"
	storeSnap := fmt.Sprintf("%s/edge", snap)

	// install edge version from the store (which is squshfs)
	cli.ExecCommand(c, "sudo", "snappy", "install", storeSnap)
	defer cli.ExecCommand(c, "sudo", "snappy", "remove", snap)

	output := updates.CallFakeUpdate(c, snap, updates.NoOp)
	c.Assert(output, check.Matches, "(?ms).*^hello-world.*fake1.*")
}
示例#2
0
// This is the logic common to all the failover tests. Each of them has to call this method
// with the snap that will be updated and the function that changes it to fail.
func (s *failoverSuite) testUpdateToBrokenVersion(c *check.C, snap string, changeFunc updates.ChangeFakeUpdateSnap) {
	snapName := strings.Split(snap, ".")[0]
	currentVersion := common.GetCurrentVersion(c, snapName)

	if common.BeforeReboot() {
		common.SetSavedVersion(c, currentVersion)
		updates.CallFakeUpdate(c, snap, changeFunc)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		c.Assert(currentVersion, check.Equals, common.GetSavedVersion(c),
			check.Commentf("Rebooted to the wrong version"))
	}
}
示例#3
0
// This is the logic common to all the failover tests. Each of them has to call this method
// with the snap that will be updated and the function that changes it to fail.
func (s *failoverSuite) testUpdateToBrokenVersion(c *check.C, snap string, changeFunc updates.ChangeFakeUpdateSnap) {
	c.Skip("KNOWN BUG FIXME: https://bugs.launchpad.net/snappy/+bug/1534029")

	snapName := strings.Split(snap, ".")[0]
	currentVersion := common.GetCurrentVersion(c, snapName)

	if common.BeforeReboot() {
		common.SetSavedVersion(c, currentVersion)
		updates.CallFakeUpdate(c, snap, changeFunc)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		common.RemoveRebootMark(c)
		c.Assert(currentVersion, check.Equals, common.GetSavedVersion(c),
			check.Commentf("Rebooted to the wrong version"))
	}
}
示例#4
0
// This is the logic common to all the failover tests. Each of them has to call this method
// with the snap that will be updated and the function that changes it to fail.
func (s *failoverSuite) testUpdateToBrokenVersion(c *check.C, snap string, changeFunc updates.ChangeFakeUpdateSnap) {
	snapName := strings.Split(snap, ".")[0]

	c.Skip("FIXME: `snap refresh` is not compatible with the fake test store")

	// FIXME: remove once the OS snap is fixed and has a working
	//        "snap booted" again
	cli.ExecCommand(c, "sudo", "snap", "booted")

	if common.BeforeReboot() {
		currentVersion := common.GetCurrentVersion(c, snapName)

		common.SetSavedVersion(c, currentVersion)
		updates.CallFakeUpdate(c, snap, changeFunc)
		common.Reboot(c)
	} else if common.AfterReboot(c) {
		currentVersion := common.GetCurrentVersion(c, snapName)

		common.RemoveRebootMark(c)
		c.Assert(currentVersion, check.Equals, common.GetSavedVersion(c),
			check.Commentf("Rebooted to the wrong version"))
	}
}