Compare commits

...

1 Commits

Author SHA1 Message Date
Andrei Kvapil
80ad9965e5 [cozystack-api] Fix List kinds
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2025-11-12 10:32:51 -05:00
2 changed files with 31 additions and 2 deletions

View File

@@ -19,3 +19,26 @@
curl -sS --fail 'http://localhost:21234/openapi/v2?timeout=32s' -H 'Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf' > /dev/null
)
}
@test "Test kinds" {
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.kind')
if [ "$val" != "TenantList" ]; then
echo "Expected kind to be TenantList, got $val"
exit 1
fi
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/tenants | jq -r '.items[0].kind')
if [ "$val" != "Tenant" ]; then
echo "Expected kind to be Tenant, got $val"
exit 1
fi
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.kind')
if [ "$val" != "IngressList" ]; then
echo "Expected kind to be IngressList, got $val"
exit 1
fi
val=$(kubectl get --raw /apis/apps.cozystack.io/v1alpha1/ingresses | jq -r '.items[0].kind')
if [ "$val" != "Ingress" ]; then
echo "Expected kind to be Ingress, got $val"
exit 1
fi
}

View File

@@ -1196,12 +1196,18 @@ func (r *REST) Destroy() {
// New creates a new instance of Application
func (r *REST) New() runtime.Object {
return &appsv1alpha1.Application{}
app := &unstructured.UnstructuredList{}
app.SetAPIVersion("apps.cozystack.io/v1alpha1")
app.SetKind(r.kindName)
return app
}
// NewList returns an empty list of Application objects
func (r *REST) NewList() runtime.Object {
return &appsv1alpha1.ApplicationList{}
appList := &unstructured.UnstructuredList{}
appList.SetAPIVersion("apps.cozystack.io/v1alpha1")
appList.SetKind(r.kindName + "List")
return appList
}
// Kind returns the resource kind used for API discovery