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

Skip kubectl tests (create quota and exit code) on not supported versions #32626

Merged
merged 1 commit into from
Sep 14, 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
10 changes: 10 additions & 0 deletions test/e2e/framework/util.go
Expand Up @@ -1756,6 +1756,16 @@ func ServerVersionGTE(v semver.Version, c discovery.ServerVersionInterface) (boo
return sv.GTE(v), nil
}

func SkipUnlessKubectlVersionGTE(v semver.Version) {
gte, err := KubectlVersionGTE(v)
if err != nil {
Failf("Failed to get kubectl version: %v", err)
}
if !gte {
Skipf("Not supported for kubectl versions before %q", v)
}
}

// KubectlVersionGTE returns true if the kubectl version is greater than or
// equal to v.
func KubectlVersionGTE(v semver.Version) (bool, error) {
Expand Down
14 changes: 13 additions & 1 deletion test/e2e/kubectl.go
Expand Up @@ -119,11 +119,19 @@ var (
// TODO(ihmccreery): remove once we don't care about v1.1 anymore, (tentatively in v1.4).
deploymentsVersion = version.MustParse("v1.2.0-alpha.7.726")

// Pod probe parameters were introduced in #15967 (v1.2) so we dont expect tests that use
// Pod probe parameters were introduced in #15967 (v1.2) so we don't expect tests that use
// these probe parameters to work on clusters before that.
//
// TODO(ihmccreery): remove once we don't care about v1.1 anymore, (tentatively in v1.4).
podProbeParametersVersion = version.MustParse("v1.2.0-alpha.4")

// 'kubectl create quota' was introduced in #28351 (v1.4) so we don't expect tests that use
// 'kubectl create quota' to work on kubectl clients before that.
kubectlCreateQuotaVersion = version.MustParse("v1.4.0-alpha.2")

// Returning container command exit codes in kubectl run/exec was introduced in #26541 (v1.4)
// so we don't expect tests that verifies return code to work on kubectl clients before that.
kubectlContainerExitCodeVersion = version.MustParse("v1.4.0-alpha.3")
)

// Stops everything from filePath from namespace ns and checks if everything matching selectors from the given namespace is correctly stopped.
Expand Down Expand Up @@ -351,6 +359,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})

It("should return command exit codes", func() {
framework.SkipUnlessKubectlVersionGTE(kubectlContainerExitCodeVersion)
nsFlag := fmt.Sprintf("--namespace=%v", ns)

By("execing into a container with a successful command")
Expand Down Expand Up @@ -1316,6 +1325,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {

framework.KubeDescribe("Kubectl create quota", func() {
It("should create a quota without scopes", func() {
framework.SkipUnlessKubectlVersionGTE(kubectlCreateQuotaVersion)
nsFlag := fmt.Sprintf("--namespace=%v", ns)
quotaName := "million"

Expand Down Expand Up @@ -1345,6 +1355,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})

It("should create a quota with scopes", func() {
framework.SkipUnlessKubectlVersionGTE(kubectlCreateQuotaVersion)
nsFlag := fmt.Sprintf("--namespace=%v", ns)
quotaName := "scopes"

Expand Down Expand Up @@ -1373,6 +1384,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
})

It("should reject quota with invalid scopes", func() {
framework.SkipUnlessKubectlVersionGTE(kubectlCreateQuotaVersion)
nsFlag := fmt.Sprintf("--namespace=%v", ns)
quotaName := "scopes"

Expand Down