Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[e2e] kubectl stdin #24806

Merged
merged 1 commit into from
May 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion hack/boilerplate/boilerplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def file_passes(filename, refs, regexs):
def file_extension(filename):
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):
newfiles = []
for pathname in files:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func setupProviderConfig() error {
if cloudConfig.Zone == "" {
return fmt.Errorf("gce-zone must be specified for AWS")
}

}

return nil
Expand Down Expand Up @@ -227,5 +226,6 @@ func RunE2ETests(t *testing.T) {
}
}
glog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunId, config.GinkgoConfig.ParallelNode)

ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r)
}
41 changes: 41 additions & 0 deletions test/e2e/framework/gobindata_util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
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
}
14 changes: 11 additions & 3 deletions test/e2e/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
func Cleanup(filePath string, ns string, selectors ...string) {
func Cleanup(filePath, ns string, selectors ...string) {
By("using delete to clean up resources")
var nsArg string
if ns != "" {
nsArg = fmt.Sprintf("--namespace=%s", ns)
}
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 {
resources := RunKubectlOrDie("get", "rc,svc", "-l", selector, "--no-headers", nsArg)
if resources != "" {
Expand Down Expand Up @@ -1564,8 +1572,8 @@ func RunKubectl(args ...string) (string, error) {
return NewKubectlCommand(args...).Exec()
}

// runKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func runKubectlOrDieInput(data string, args ...string) string {
// RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlOrDieInput(data string, args ...string) string {
return NewKubectlCommand(args...).WithStdinData(data).ExecOrDie()
}

Expand Down