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

Commit

Permalink
tests: use loop to generate units' args slice
Browse files Browse the repository at this point in the history
  • Loading branch information
kayrus committed Mar 17, 2016
1 parent cfbb3fc commit 6c08547
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion functional/tunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,19 @@ func TestTunnelScheduleBatchUnits(t *testing.T) {
t.Fatalf("Failed to correctly submit unit using ssh tunnel: \nstdout: %s\nstderr: %s\nerr: %v", stdout, stderr, err)
}

// Combine all parameters and units in one args slice
args := []string{
fmt.Sprintf("--tunnel=%s", m0.IP()),
"--strict-host-key-checking=true",
fmt.Sprintf("--known-hosts-file=%s", khFile),
"start",
}
for i := 1; i <= 10; i++ {
args = append(args, fmt.Sprintf("fixtures/units/hello@%d.service", i))
}

// Launch a batch of units
if stdout, stderr, err := cluster.Fleetctl(m0, fmt.Sprintf("--tunnel=%s", m0.IP()), "--strict-host-key-checking=true", fmt.Sprintf("--known-hosts-file=%s", khFile), "start", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]", "fixtures/units/[email protected]"); err != nil {
if stdout, stderr, err := cluster.Fleetctl(m0, args...); err != nil {
t.Fatalf("Unable to submit batch of units using ssh tunnel: \nstdout: %s\nstderr: %s\nerr: %v", stdout, stderr, err)
} else if strings.Contains(stderr, "Error") {
t.Fatalf("Failed to correctly submit batch of units using ssh tunnel: \nstdout: %s\nstderr: %s\nerr: %v", stdout, stderr, err)
Expand Down

0 comments on commit 6c08547

Please sign in to comment.