Assert all APIs have a status subresource
Signed-off-by: Monis Khan <mok@vmware.com>
This commit is contained in:
parent
0a9f446893
commit
4c304e4224
@ -103,6 +103,12 @@ func TestGetAPIResourceList(t *testing.T) {
|
|||||||
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
||||||
Categories: []string{"pinniped"},
|
Categories: []string{"pinniped"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "federationdomains/status",
|
||||||
|
Namespaced: true,
|
||||||
|
Kind: "FederationDomain",
|
||||||
|
Verbs: []string{"get", "patch", "update"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -163,6 +169,12 @@ func TestGetAPIResourceList(t *testing.T) {
|
|||||||
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
||||||
Categories: []string{"pinniped"},
|
Categories: []string{"pinniped"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "credentialissuers/status",
|
||||||
|
Namespaced: false,
|
||||||
|
Kind: "CredentialIssuer",
|
||||||
|
Verbs: []string{"get", "patch", "update"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -190,6 +202,12 @@ func TestGetAPIResourceList(t *testing.T) {
|
|||||||
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
||||||
Categories: []string{"pinniped", "pinniped-authenticator", "pinniped-authenticators"},
|
Categories: []string{"pinniped", "pinniped-authenticator", "pinniped-authenticators"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "webhookauthenticators/status",
|
||||||
|
Namespaced: false,
|
||||||
|
Kind: "WebhookAuthenticator",
|
||||||
|
Verbs: []string{"get", "patch", "update"},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "jwtauthenticators",
|
Name: "jwtauthenticators",
|
||||||
SingularName: "jwtauthenticator",
|
SingularName: "jwtauthenticator",
|
||||||
@ -198,6 +216,12 @@ func TestGetAPIResourceList(t *testing.T) {
|
|||||||
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
Verbs: []string{"delete", "deletecollection", "get", "list", "patch", "create", "update", "watch"},
|
||||||
Categories: []string{"pinniped", "pinniped-authenticator", "pinniped-authenticators"},
|
Categories: []string{"pinniped", "pinniped-authenticator", "pinniped-authenticators"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "jwtauthenticators/status",
|
||||||
|
Namespaced: false,
|
||||||
|
Kind: "JWTAuthenticator",
|
||||||
|
Verbs: []string{"get", "patch", "update"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -253,6 +277,32 @@ func TestGetAPIResourceList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("every API has a status subresource", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
var regular, status []string
|
||||||
|
|
||||||
|
for _, r := range resources {
|
||||||
|
if !strings.Contains(r.GroupVersion, env.APIGroupSuffix) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, a := range r.APIResources {
|
||||||
|
if a.Name == "tokencredentialrequests" {
|
||||||
|
continue // our special aggregated API with its own magical properties
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.HasSuffix(a.Name, "/status") {
|
||||||
|
status = append(status, strings.TrimSuffix(a.Name, "/status"))
|
||||||
|
} else {
|
||||||
|
regular = append(regular, a.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, regular, status)
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("Pinniped resources do not have short names", func(t *testing.T) {
|
t.Run("Pinniped resources do not have short names", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, r := range resources {
|
for _, r := range resources {
|
||||||
|
Loading…
Reference in New Issue
Block a user