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: added "fleetctl --tunnel" tests
- Loading branch information
Showing
5 changed files
with
124 additions
and
2 deletions.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Service] | ||
ExecStart=/bin/bash -c "while true; do echo Hello, World %i!; sleep 1; done" |
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
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
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright 2014 CoreOS, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package functional | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"syscall" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/coreos/fleet/functional/platform" | ||
) | ||
|
||
// Start three units using ssh tunnel | ||
func TestTunnelScheduleBatchUnits(t *testing.T) { | ||
cluster, err := platform.NewNspawnCluster("smoke") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer cluster.Destroy() | ||
|
||
members, err := platform.CreateNClusterMembers(cluster, 1) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
m0 := members[0] | ||
_, err = cluster.WaitForNMachines(m0, 1) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
tmp, err := ioutil.TempFile(os.TempDir(), "known-hosts") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
tmp.Close() | ||
defer syscall.Unlink(tmp.Name()) | ||
|
||
khFile := tmp.Name() | ||
|
||
// Launch one unit | ||
if stdout, stderr, err := cluster.FleetctlTunnelWithInput(m0, "yes", "--strict-host-key-checking=true", fmt.Sprintf("--known-hosts-file=%s", khFile), "start", "fixtures/units/hello.service"); err != nil { | ||
t.Fatalf("Unable to submit one unit using ssh tunnel: \nstdout: %s\nstderr: %s\nerr: %v", stdout, stderr, err) | ||
} else if strings.Contains(stderr, "Error") { | ||
t.Fatalf("Failed to correctly submit unit using ssh tunnel: \nstdout: %s\nstderr: %s\nerr: %v", stdout, stderr, err) | ||
} | ||
|
||
// Launch a batch of units | ||
if stdout, stderr, err := cluster.FleetctlTunnel(m0, "--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]"); 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) | ||
} | ||
} |
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