Commit 801c968f authored by Jay Vyas's avatar Jay Vyas

Standard input for kubectl tests

rebased to include gobindata as well.
parent 6f288b31
...@@ -105,7 +105,8 @@ def file_passes(filename, refs, regexs): ...@@ -105,7 +105,8 @@ def file_passes(filename, refs, regexs):
def file_extension(filename): def file_extension(filename):
return os.path.splitext(filename)[1].split(".")[-1].lower() return os.path.splitext(filename)[1].split(".")[-1].lower()
skipped_dirs = ['vendor', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh', 'vendor'] skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh', "vendor", "test/e2e/generated/bindata.go"]
def normalize_files(files): def normalize_files(files):
newfiles = [] newfiles = []
for pathname in files: for pathname in files:
......
...@@ -81,7 +81,6 @@ func setupProviderConfig() error { ...@@ -81,7 +81,6 @@ func setupProviderConfig() error {
if cloudConfig.Zone == "" { if cloudConfig.Zone == "" {
return fmt.Errorf("gce-zone must be specified for AWS") return fmt.Errorf("gce-zone must be specified for AWS")
} }
} }
return nil return nil
...@@ -227,5 +226,6 @@ func RunE2ETests(t *testing.T) { ...@@ -227,5 +226,6 @@ func RunE2ETests(t *testing.T) {
} }
} }
glog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunId, config.GinkgoConfig.ParallelNode) glog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunId, config.GinkgoConfig.ParallelNode)
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r) ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r)
} }
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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 framework
import "k8s.io/kubernetes/test/e2e/generated"
// ReadOrDie reads a file from gobindata. To generate gobindata, run
//
// # Install the program
// go get -u github.com/jteeuwen/go-bindata/...
//
// # Generate the bindata file.
// go-bindata \
// -pkg generated -ignore .jpg -ignore .png -ignore .md \
// ./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/*
//
// # Copy it into the generated directory if the results are what you expected.
// cp bindata.go test/e2e/generated
func ReadOrDie(filePath string) []byte {
fileBytes, err := generated.Asset(filePath)
if err != nil {
gobindata_msg := "An error occured, possibly gobindata doesn't know about the file you're opening. For questions on maintaining gobindata, contact the sig-testing group."
Logf("Available gobindata files: %v ", generated.AssetNames())
Failf("Failed opening %v , with error %v. %v.", filePath, err, gobindata_msg)
}
return fileBytes
}
...@@ -1372,14 +1372,22 @@ func ExpectNoError(err error, explain ...interface{}) { ...@@ -1372,14 +1372,22 @@ func ExpectNoError(err error, explain ...interface{}) {
} }
// Stops everything from filePath from namespace ns and checks if everything matching selectors from the given namespace is correctly stopped. // Stops everything from filePath from namespace ns and checks if everything matching selectors from the given namespace is correctly stopped.
func Cleanup(filePath string, ns string, selectors ...string) { func Cleanup(filePath, ns string, selectors ...string) {
By("using delete to clean up resources") By("using delete to clean up resources")
var nsArg string var nsArg string
if ns != "" { if ns != "" {
nsArg = fmt.Sprintf("--namespace=%s", ns) nsArg = fmt.Sprintf("--namespace=%s", ns)
} }
RunKubectlOrDie("delete", "--grace-period=0", "-f", filePath, nsArg) RunKubectlOrDie("delete", "--grace-period=0", "-f", filePath, nsArg)
AssertCleanup(ns, selectors...)
}
// Asserts that cleanup of a namespace wrt selectors occured.
func AssertCleanup(ns string, selectors ...string) {
var nsArg string
if ns != "" {
nsArg = fmt.Sprintf("--namespace=%s", ns)
}
for _, selector := range selectors { for _, selector := range selectors {
resources := RunKubectlOrDie("get", "rc,svc", "-l", selector, "--no-headers", nsArg) resources := RunKubectlOrDie("get", "rc,svc", "-l", selector, "--no-headers", nsArg)
if resources != "" { if resources != "" {
...@@ -1564,8 +1572,8 @@ func RunKubectl(args ...string) (string, error) { ...@@ -1564,8 +1572,8 @@ func RunKubectl(args ...string) (string, error) {
return NewKubectlCommand(args...).Exec() return NewKubectlCommand(args...).Exec()
} }
// runKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin // RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func runKubectlOrDieInput(data string, args ...string) string { func RunKubectlOrDieInput(data string, args ...string) string {
return NewKubectlCommand(args...).WithStdinData(data).ExecOrDie() return NewKubectlCommand(args...).WithStdinData(data).ExecOrDie()
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment