func cleanUnits(cl platform.Cluster, m platform.Member, cmd string, ufs []string, nu int) (err error) { for i := 0; i < nu; i++ { if _, _, err := cl.Fleetctl(m, cmd, ufs[i]); err != nil { return fmt.Errorf("Failed to %s unit: %v", cmd, err) } } return nil }
func launchUnitsCmd(cluster platform.Cluster, m platform.Member, cmd string, numUnits int) (unitFiles []string, err error) { args := []string{cmd} for i := 0; i < numUnits; i++ { unitFile := fmt.Sprintf("fixtures/units/hello@%d.service", i+1) args = append(args, unitFile) unitFiles = append(unitFiles, path.Base(unitFile)) } if stdout, stderr, err := cluster.Fleetctl(m, args...); err != nil { return nil, fmt.Errorf("Unable to %s batch of units: \nstdout: %s\nstderr: %s\nerr: %v", cmd, stdout, stderr, err) } else if strings.Contains(stderr, "Error") { return nil, fmt.Errorf("Failed to correctly %s batch of units: \nstdout: %s\nstderr: %s\nerr: %v", cmd, stdout, stderr, err) } return unitFiles, nil }