kola/tests/fleet: Retry unit status detection
The fleet documentation claims that starting units should block
until it's active, but that is not the case.  Since fleet is slated
for removal from the OS in February 2018, just add back retry logic
that was there originally so tests aren't randomly failing.
@@ -16,6 +16,7 @@ package fleet
import (
"bytes"
+ "fmt"
"time"
"github.com/coreos/mantle/kola/cluster"
@@ -153,12 +154,20 @@ func Proxy(c cluster.TestCluster) {
c.Fatalf("fleetctl start failed: %v", err)
}
+ fleetList := func() error {
status, err := proxy.SSH("fleetctl list-units -l -fields active -no-legend")
if err != nil {
- c.Fatalf("fleetctl list-units failed: %v", err)
+ return err
}
if !bytes.Equal(status, []byte("active")) {
- c.Fatalf("unit not active: %s", status)
+ return fmt.Errorf("unit not active: %s", status)
+ }
+
+ return nil
+ }
+
+ if err := util.Retry(5, 1*time.Second, fleetList); err != nil {
+ c.Fatalf("fleetctl list-units failed: %v", err)
}
}
