mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #116545 from flant/table-ssr-e2e
Fix DescribeTable for selfsubjectreview e2e
This commit is contained in:
commit
b740a34302
@ -46,68 +46,68 @@ var _ = SIGDescribe("SelfSubjectReview [Feature:APISelfSubjectReview]", func() {
|
|||||||
The selfsubjectreviews resource MUST exist in the /apis/authentication.k8s.io/v1beta1 discovery document.
|
The selfsubjectreviews resource MUST exist in the /apis/authentication.k8s.io/v1beta1 discovery document.
|
||||||
The selfsubjectreviews resource MUST support create.
|
The selfsubjectreviews resource MUST support create.
|
||||||
*/
|
*/
|
||||||
ginkgo.It("should support SelfSubjectReview API operations", func(ctx context.Context) {
|
ginkgo.DescribeTable(
|
||||||
ginkgo.DescribeTable(
|
"testing SSR in different API groups",
|
||||||
"testing SSR in different API groups",
|
func(ctx context.Context, apiVersion, gv string) {
|
||||||
func(apiVersion, gv string) {
|
// Discovery
|
||||||
// Discovery
|
ginkgo.By("getting /apis")
|
||||||
ginkgo.By("getting /apis")
|
{
|
||||||
{
|
discoveryGroups, err := f.ClientSet.Discovery().ServerGroups()
|
||||||
discoveryGroups, err := f.ClientSet.Discovery().ServerGroups()
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(err)
|
found := false
|
||||||
found := false
|
for _, group := range discoveryGroups.Groups {
|
||||||
for _, group := range discoveryGroups.Groups {
|
if group.Name == authenticationv1alpha1.GroupName {
|
||||||
if group.Name == authenticationv1alpha1.GroupName {
|
for _, version := range group.Versions {
|
||||||
for _, version := range group.Versions {
|
if version.Version == apiVersion {
|
||||||
if version.Version == apiVersion {
|
found = true
|
||||||
found = true
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
}
|
||||||
ginkgo.Skip(fmt.Sprintf("expected SelfSubjectReview API group/version, got %#v", discoveryGroups.Groups))
|
if !found {
|
||||||
|
ginkgo.Skip(fmt.Sprintf("expected SelfSubjectReview API group/version, got %#v", discoveryGroups.Groups))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ginkgo.By("getting /apis/authentication.k8s.io")
|
||||||
|
{
|
||||||
|
group := &metav1.APIGroup{}
|
||||||
|
err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/authentication.k8s.io").Do(ctx).Into(group)
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
found := false
|
||||||
|
for _, version := range group.Versions {
|
||||||
|
if version.Version == apiVersion {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !found {
|
||||||
|
ginkgo.Skip(fmt.Sprintf("expected SelfSubjectReview API version, got %#v", group.Versions))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ginkgo.By("getting /apis/authentication.k8s.io")
|
ginkgo.By("getting /apis/authentication.k8s.io/" + apiVersion)
|
||||||
{
|
{
|
||||||
group := &metav1.APIGroup{}
|
resources, err := f.ClientSet.Discovery().ServerResourcesForGroupVersion(gv)
|
||||||
err := f.ClientSet.Discovery().RESTClient().Get().AbsPath("/apis/authentication.k8s.io").Do(ctx).Into(group)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(err)
|
found := false
|
||||||
found := false
|
for _, resource := range resources.APIResources {
|
||||||
for _, version := range group.Versions {
|
switch resource.Name {
|
||||||
if version.Version == apiVersion {
|
case "selfsubjectreviews":
|
||||||
found = true
|
found = true
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
ginkgo.Skip(fmt.Sprintf("expected SelfSubjectReview API version, got %#v", group.Versions))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !found {
|
||||||
ginkgo.By("getting /apis/authentication.k8s.io/" + apiVersion)
|
ginkgo.Skip(fmt.Sprintf("expected selfsubjectreviews, got %#v", resources.APIResources))
|
||||||
{
|
|
||||||
resources, err := f.ClientSet.Discovery().ServerResourcesForGroupVersion(gv)
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
found := false
|
|
||||||
for _, resource := range resources.APIResources {
|
|
||||||
switch resource.Name {
|
|
||||||
case "selfsubjectreviews":
|
|
||||||
found = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
ginkgo.Skip(fmt.Sprintf("expected selfsubjectreviews, got %#v", resources.APIResources))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ginkgo.Entry("authentication/v1alpha1", "v1alpha1", authenticationv1alpha1.SchemeGroupVersion.String()),
|
},
|
||||||
ginkgo.Entry("authentication/v1beta1", "v1beta1", authenticationv1beta1.SchemeGroupVersion.String()),
|
ginkgo.Entry("authentication/v1alpha1", "v1alpha1", authenticationv1alpha1.SchemeGroupVersion.String()),
|
||||||
)
|
ginkgo.Entry("authentication/v1beta1", "v1beta1", authenticationv1beta1.SchemeGroupVersion.String()),
|
||||||
|
)
|
||||||
|
|
||||||
|
ginkgo.It("should support SelfSubjectReview API operations", func(ctx context.Context) {
|
||||||
// Check creating
|
// Check creating
|
||||||
ginkgo.By("creating SSR authentication/v1alpha1")
|
ginkgo.By("creating SSR authentication/v1alpha1")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user