Ensure request returns current server version

This commit is contained in:
Stephen Heywood 2020-06-26 00:01:35 +00:00
parent f38ce5725a
commit 2eabf97a58
2 changed files with 45 additions and 0 deletions

View File

@ -21,6 +21,7 @@ go_library(
"framework.go",
"garbage_collector.go",
"generated_clientset.go",
"get_code_version.go",
"namespace.go",
"protocol.go",
"resource_quota.go",

View File

@ -0,0 +1,44 @@
/*
Copyright 2019 The Kubernetes Authors.
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 apimachinery
import (
"k8s.io/apimachinery/pkg/version"
"k8s.io/kubernetes/test/e2e/framework"
"github.com/onsi/ginkgo"
)
var _ = SIGDescribe("get-code-version", func() {
f := framework.NewDefaultFramework("get-code-version")
ginkgo.It("should find the server version", func() {
ginkgo.By("Request ServerVersion")
var version *version.Info
version, err := f.ClientSet.Discovery().ServerVersion()
framework.ExpectNoError(err, "Fail to access ServerVersion")
ginkgo.By("Confirm major version")
framework.ExpectEqual(version.Major, "1", "unable to find major version")
framework.Logf("Major version: %v", version.Major)
ginkgo.By("Confirm minor version")
framework.ExpectEqual(version.Minor, "19+", "unable to find minor version")
framework.Logf("Minor version: %v", version.Minor)
})
})