kola/tests: rework `rpmostree` tests to use `FailFast`
The `upgrade/rollback` and `install/unistall` tests require the
previoust state of the host to be successful/known, so let's re-work
those tests to take advantage of the `FailFast` capability.
@@ -30,6 +30,7 @@ func init() {
ClusterSize: 1,
Name: "rpmostree.upgrade-rollback",
Distros: []string{"rhcos", "fcos"},
+ FailFast: true,
})
register.Register(&register.Test{
Run: rpmOstreeInstallUninstall,
@@ -97,6 +98,7 @@ func rpmOstreeUpgradeRollback(c cluster.TestCluster) {
c.Fatalf(`Unexpected results from "rpm-ostree status"; received: %v`, originalStatus)
}
+ c.Run("upgrade", func(c cluster.TestCluster) {
// create a local branch to act as our upgrade target
originalCsum := originalStatus.Deployments[0].Checksum
createBranch := "sudo ostree refs --create " + newBranch + " " + originalCsum
@@ -156,7 +158,9 @@ func rpmOstreeUpgradeRollback(c cluster.TestCluster) {
if postRebootStatus.Deployments[0].Version != newVersion {
c.Fatalf(`New deployment version is incorrect; expected %q, got %q`, newVersion, postRebootStatus.Deployments[0].Checksum)
}
+ })
+ c.Run("rollback", func(c cluster.TestCluster) {
// rollback to original deployment
c.MustSSH(m, "sudo rpm-ostree rollback")
@@ -186,10 +190,14 @@ func rpmOstreeUpgradeRollback(c cluster.TestCluster) {
if cleanupErr != nil {
c.Fatal(cleanupErr)
}
+ })
}
// rpmOstreeInstallUninstall verifies that we can install a package
// and then uninstall it
+// we've hardcoded 'fpaste' throughout the test because it should be
+// a package that a) will be around a long time and b) is small +
+// well-defined
func rpmOstreeInstallUninstall(c cluster.TestCluster) {
m := c.Machines()[0]
@@ -203,6 +211,8 @@ func rpmOstreeInstallUninstall(c cluster.TestCluster) {
}
originalCsum := originalStatus.Deployments[0].Checksum
+
+ c.Run("install", func(c cluster.TestCluster) {
// install fpaste and reboot
c.MustSSH(m, "sudo rpm-ostree install fpaste")
@@ -263,8 +273,10 @@ func rpmOstreeInstallUninstall(c cluster.TestCluster) {
if postInstallStatus.Deployments[0].Checksum == originalCsum {
c.Fatalf(`Commit IDs incorrectly matched after package install`)
}
+ })
// uninstall the package
+ c.Run("uninstall", func(c cluster.TestCluster) {
c.MustSSH(m, "sudo rpm-ostree uninstall fpaste")
uninstallRebootErr := m.Reboot()
@@ -299,5 +311,5 @@ func rpmOstreeInstallUninstall(c cluster.TestCluster) {
if cleanupErr != nil {
c.Fatal(cleanupErr)
}
-
+ })
}
