Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
functional: always use list-unit-files to fetch a units list
Browse files Browse the repository at this point in the history
For some reason "fleetctl list-units" occasionally returns a list
without some entries, especially when loading multiple units at the
same time. Until the issue gets resolved, let's avoid the such errors,
by using "fleetctl list-unit-files".
  • Loading branch information
Dongsu Park committed Mar 16, 2016
1 parent d695f3a commit f2412d0
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions functional/unit_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,6 @@ func replaceUnitMultiple(cmd string, n int) error {
return fmt.Errorf("invalid command %s", cmd)
}

var listUnitCmd string
if cmd == "submit" {
listUnitCmd = "list-unit-files"
} else {
listUnitCmd = "list-units"
}

cluster, err := platform.NewNspawnCluster("smoke")
if err != nil {
return fmt.Errorf("%v", err)
Expand Down Expand Up @@ -396,9 +389,9 @@ func replaceUnitMultiple(cmd string, n int) error {
return fmt.Errorf("Unable to %s fleet unit: %v", cmd, err)
}

stdout, _, err = cluster.Fleetctl(m, listUnitCmd, "--no-legend")
stdout, _, err = cluster.Fleetctl(m, "list-unit-files", "--no-legend")
if err != nil {
return fmt.Errorf("Failed to run %s: %v", listUnitCmd, err)
return fmt.Errorf("Failed to run %s: %v", "list-unit-files", err)
}
units := strings.Split(strings.TrimSpace(stdout), "\n")
if len(units) != i {
Expand All @@ -419,9 +412,9 @@ func replaceUnitMultiple(cmd string, n int) error {
if _, _, err = cluster.Fleetctl(m, cmd, "--replace", curHelloService); err != nil {
return fmt.Errorf("Unable to replace fleet unit: %v", err)
}
stdout, _, err = cluster.Fleetctl(m, listUnitCmd, "--no-legend")
stdout, _, err = cluster.Fleetctl(m, "list-unit-files", "--no-legend")
if err != nil {
return fmt.Errorf("Failed to run %s: %v", listUnitCmd, err)
return fmt.Errorf("Failed to run %s: %v", "list-unit-files", err)
}
units := strings.Split(strings.TrimSpace(stdout), "\n")
if len(units) != n {
Expand Down

0 comments on commit f2412d0

Please sign in to comment.