This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: use loop to generate units' args slice
- Loading branch information
Showing
1 changed file
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|