Scopes: Add basic integration tests (#85351)

Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
Ryan McKinley
2024-03-29 17:12:28 +03:00
committed by GitHub
parent 20eac8d264
commit dd6c8732b3
7 changed files with 217 additions and 16 deletions

View File

@@ -45,7 +45,6 @@ func (b *ScopeAPIBuilder) GetGroupVersion() schema.GroupVersion {
}
func (b *ScopeAPIBuilder) InstallSchema(scheme *runtime.Scheme) error {
gv := scope.SchemeGroupVersion
err := scope.AddToScheme(scheme)
if err != nil {
return err
@@ -83,15 +82,14 @@ func (b *ScopeAPIBuilder) InstallSchema(scheme *runtime.Scheme) error {
return err
}
// Link this version to the internal representation.
// This is used for server-side-apply (PATCH), and avoids the error:
// "no kind is registered for the type"
// addKnownTypes(scheme, schema.GroupVersion{
// Group: scope.GROUP,
// Version: runtime.APIVersionInternal,
// })
metav1.AddToGroupVersion(scheme, gv)
return scheme.SetVersionPriority(gv)
// This is required for --server-side apply
err = scope.AddKnownTypes(scope.InternalGroupVersion, scheme)
if err != nil {
return err
}
// Only one version right now
return scheme.SetVersionPriority(scope.SchemeGroupVersion)
}
func (b *ScopeAPIBuilder) GetAPIGroupInfo(