mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Validate that PreferredVersion contains a valid option
This commit is contained in:
parent
e81b6dce15
commit
f886164491
@ -9,7 +9,7 @@ go_library(
|
|||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"aggregator.go",
|
"aggregator.go",
|
||||||
"apigroup_list.go",
|
"apigroup_preferred_version.go",
|
||||||
"certs.go",
|
"certs.go",
|
||||||
"chunking.go",
|
"chunking.go",
|
||||||
"crd_conversion_webhook.go",
|
"crd_conversion_webhook.go",
|
||||||
|
@ -28,9 +28,6 @@ var _ = SIGDescribe("apigroup list", func() {
|
|||||||
f := framework.NewDefaultFramework("apigroup-list")
|
f := framework.NewDefaultFramework("apigroup-list")
|
||||||
ginkgo.It("should locate PreferredVersion for each APIGroup", func() {
|
ginkgo.It("should locate PreferredVersion for each APIGroup", func() {
|
||||||
|
|
||||||
// TEST BEGINS HERE
|
|
||||||
ginkgo.By("[status] begin")
|
|
||||||
|
|
||||||
// get list of APIGroup endpoints
|
// get list of APIGroup endpoints
|
||||||
list := &metav1.APIGroupList{}
|
list := &metav1.APIGroupList{}
|
||||||
err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/").Do(context.TODO()).Into(list)
|
err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/").Do(context.TODO()).Into(list)
|
||||||
@ -44,11 +41,21 @@ var _ = SIGDescribe("apigroup list", func() {
|
|||||||
checkGroup := &metav1.APIGroup{}
|
checkGroup := &metav1.APIGroup{}
|
||||||
apiPath := "/apis/" + group.Name + "/"
|
apiPath := "/apis/" + group.Name + "/"
|
||||||
err = f.ClientSet.Discovery().RESTClient().Get().AbsPath(apiPath).Do(context.TODO()).Into(checkGroup)
|
err = f.ClientSet.Discovery().RESTClient().Get().AbsPath(apiPath).Do(context.TODO()).Into(checkGroup)
|
||||||
|
|
||||||
framework.ExpectNoError(err, "Fail to access: %s", apiPath)
|
framework.ExpectNoError(err, "Fail to access: %s", apiPath)
|
||||||
|
|
||||||
// get PreferredVersion for endpoint
|
framework.Logf("PreferredVersion.GroupVersion: %s", checkGroup.PreferredVersion.GroupVersion)
|
||||||
framework.Logf("PreferredVersion: %v", checkGroup.PreferredVersion)
|
framework.Logf("Versions found %v", checkGroup.Versions)
|
||||||
|
|
||||||
|
// confirm that the PreferredVersion is a valid version
|
||||||
|
match := false
|
||||||
|
for _, version := range checkGroup.Versions {
|
||||||
|
if version.GroupVersion == checkGroup.PreferredVersion.GroupVersion {
|
||||||
|
framework.Logf("%s matches %s", version.GroupVersion, checkGroup.PreferredVersion.GroupVersion)
|
||||||
|
match = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
framework.ExpectEqual(true, match, "failed to find a valid version for PreferredVersion")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
Loading…
Reference in New Issue
Block a user