mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #32626 from janetkuo/skip-kubectl-test
Automatic merge from submit-queue Skip kubectl tests (create quota and exit code) on not supported versions <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: Fixing broken kubernetes-e2e-gke-1.4-1.3-kubectl-skew tests. Because we're running 1.4 kubectl tests against 1.3 kubectl, some kubectl tests need to be skipped on older kubectl versions. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: @pwittrock **Release note**: <!-- Steps to write your release note: 1. Use the release-note-* labels to set the release note state (if you have access) 2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. --> ```release-note NONE ```
This commit is contained in:
commit
8cca9d4fad
@ -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) {
|
||||
|
@ -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.
|
||||
@ -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")
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user