mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
check if kubectl version required values are empty
This commit is contained in:
parent
9af86e8db8
commit
06148eda25
@ -1507,11 +1507,12 @@ metadata:
|
|||||||
Description: The command 'kubectl version' MUST return the major, minor versions, GitCommit, etc of the Client and the Server that the kubectl is configured to connect to.
|
Description: The command 'kubectl version' MUST return the major, minor versions, GitCommit, etc of the Client and the Server that the kubectl is configured to connect to.
|
||||||
*/
|
*/
|
||||||
framework.ConformanceIt("should check is all data is printed ", func() {
|
framework.ConformanceIt("should check is all data is printed ", func() {
|
||||||
version := framework.RunKubectlOrDie(ns, "version")
|
versionString := framework.RunKubectlOrDie(ns, "version")
|
||||||
requiredItems := []string{"Client Version:", "Server Version:", "Major:", "Minor:", "GitCommit:"}
|
// we expect following values for: Major -> digit, Minor -> numeric followed by an optional '+', GitCommit -> alphanumeric
|
||||||
|
requiredItems := []string{"Client Version: ", "Server Version: "}
|
||||||
for _, item := range requiredItems {
|
for _, item := range requiredItems {
|
||||||
if !strings.Contains(version, item) {
|
if matched, _ := regexp.MatchString(item+`version.Info\{Major:"\d", Minor:"\d+\+?", GitVersion:"v\d\.\d+\.[\d\w\-\.\+]+", GitCommit:"[0-9a-f]+"`, versionString); !matched {
|
||||||
framework.Failf("Required item %s not found in %s", item, version)
|
framework.Failf("Item %s value is not valid in %s\n", item, versionString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user