Playlists: Migrate to App SDK codegen (#93246)

This commit is contained in:
Todd Treece
2024-09-13 16:27:40 -04:00
committed by GitHub
parent 8a712fd510
commit d1ffcc22d9
50 changed files with 1252 additions and 620 deletions
+15 -13
View File
@@ -14,7 +14,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
playlistv0alpha1 "github.com/grafana/grafana/pkg/apis/playlist/v0alpha1"
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
"github.com/grafana/grafana/pkg/services/apiserver/options"
"github.com/grafana/grafana/pkg/services/featuremgmt"
@@ -35,6 +34,8 @@ var gvr = schema.GroupVersionResource{
Resource: "playlists",
}
var RESOURCEGROUP = gvr.GroupResource().String()
func TestIntegrationPlaylist(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
@@ -95,7 +96,7 @@ func TestIntegrationPlaylist(t *testing.T) {
DisableAnonymous: true,
APIServerStorageType: "file", // write the files to disk
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode0,
},
},
@@ -111,7 +112,7 @@ func TestIntegrationPlaylist(t *testing.T) {
DisableAnonymous: true,
APIServerStorageType: "file", // write the files to disk
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode1,
},
},
@@ -127,7 +128,7 @@ func TestIntegrationPlaylist(t *testing.T) {
DisableAnonymous: true,
APIServerStorageType: "file", // write the files to disk
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode2,
},
},
@@ -143,7 +144,7 @@ func TestIntegrationPlaylist(t *testing.T) {
DisableAnonymous: true,
APIServerStorageType: "file", // write the files to disk
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode3,
},
},
@@ -162,7 +163,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode0,
},
},
@@ -187,7 +188,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode2,
},
},
@@ -203,7 +204,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode3,
},
},
@@ -219,7 +220,7 @@ func TestIntegrationPlaylist(t *testing.T) {
DisableAnonymous: true,
APIServerStorageType: "etcd", // requires etcd running on localhost:2379
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode0,
},
},
@@ -251,7 +252,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode1,
},
},
@@ -280,7 +281,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode2,
},
},
@@ -309,7 +310,7 @@ func TestIntegrationPlaylist(t *testing.T) {
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
playlistv0alpha1.RESOURCEGROUP: {
RESOURCEGROUP: {
DualWriterMode: grafanarest.Mode3,
},
},
@@ -453,7 +454,8 @@ func doPlaylistTests(t *testing.T, helper *apis.K8sTestHelper) *apis.K8sTestHelp
}
],
"title": "Test"
}
},
"status": {}
}`
// List includes the expected result