K8s/Dashboards: Remove uid+version from spec (#101992)
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
"github.com/grafana/grafana/pkg/infra/slugify"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/apis"
|
||||
"github.com/grafana/grafana/pkg/tests/testinfra"
|
||||
@@ -313,6 +314,22 @@ func TestIntegrationLegacySupport(t *testing.T) {
|
||||
obj, err = client.Get(ctx, name, metav1.GetOptions{}, "dto")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, name, obj.GetName())
|
||||
|
||||
if obj.Object["spec"] == nil {
|
||||
continue // missing conversions
|
||||
}
|
||||
|
||||
// This should have been moved to metadata
|
||||
spec, _, err := unstructured.NestedMap(obj.Object, "spec")
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Nil(t, spec["id"])
|
||||
require.Nil(t, spec["uid"])
|
||||
require.Nil(t, spec["version"])
|
||||
|
||||
access, _, err := unstructured.NestedMap(obj.Object, "access")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, slugify.Slugify(spec["title"].(string)), access["slug"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,3 +4,5 @@ metadata:
|
||||
name: test-v0
|
||||
spec:
|
||||
title: Test dashboard. Created at v0
|
||||
uid: test-v0 # will be removed by mutation hook
|
||||
version: 1234567 # will be removed by mutation hook
|
||||
|
||||
@@ -3,4 +3,6 @@ kind: Dashboard
|
||||
metadata:
|
||||
name: test-v1
|
||||
spec:
|
||||
title: Test dashboard. Created at v1 XXX
|
||||
title: Test dashboard. Created at v1
|
||||
uid: test-v1 # will be removed by mutation hook
|
||||
version: 1234567 # will be removed by mutation hook
|
||||
|
||||
Reference in New Issue
Block a user