K8s/Dashboard: Set generation from version (#99142)

This commit is contained in:
Ryan McKinley
2025-01-17 13:52:01 +02:00
committed by GitHub
parent a0d1a197e3
commit 7c04247d6f
3 changed files with 10 additions and 0 deletions
@@ -10,6 +10,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/grafana/grafana/pkg/apimachinery/utils"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/apis"
"github.com/grafana/grafana/pkg/tests/testinfra"
@@ -60,6 +61,12 @@ func runDashboardTest(t *testing.T, helper *apis.K8sTestHelper) {
obj, err = client.Resource.Get(ctx, created, metav1.GetOptions{})
require.NoError(t, err)
require.Equal(t, created, obj.GetName())
require.Equal(t, int64(1), obj.GetGeneration())
wrap, err := utils.MetaAccessor(obj)
require.NoError(t, err)
require.Empty(t, wrap.GetRepositoryName()) // no SQL repo stub
require.Equal(t, helper.Org1.Admin.Identity.GetUID(), wrap.GetCreatedBy())
// Commented out because the dynamic client does not like lists as sub-resource
// // Check that it now appears in the history