Skip to content

Commit

Permalink
Add mode 1 playlist integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
suntala committed May 31, 2024
1 parent 26faefd commit 6a02330
Showing 1 changed file with 61 additions and 4 deletions.
65 changes: 61 additions & 4 deletions pkg/tests/apis/playlist/playlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,22 @@ func TestIntegrationPlaylist(t *testing.T) {
}))
})

// #TODO add equivalent tests for the other modes
t.Run("with dual write (file)", func(t *testing.T) {
// #TODO Enable this test once we have fixed dual writing mode 1 behavior
// t.Run("with dual write (file, mode 1)", func(t *testing.T) {
// doPlaylistTests(t, apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
// AppModeProduction: true,
// DisableAnonymous: true,
// APIServerStorageType: "file", // write the files to disk
// EnableFeatureToggles: []string{
// featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
// },
// DualWriterDesiredModes: map[string]grafanarest.DualWriterMode{
// "playlist": grafanarest.Mode1,
// },
// }))
// })

t.Run("with dual write (file, mode 2)", func(t *testing.T) {
doPlaylistTests(t, apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: true,
DisableAnonymous: true,
Expand All @@ -101,7 +115,23 @@ func TestIntegrationPlaylist(t *testing.T) {
}))
})

t.Run("with dual write (unified storage)", func(t *testing.T) {
// #TODO Enable this test once we have fixed dual writing mode 1 behavior
// t.Run("with dual write (unified storage, mode 1)", func(t *testing.T) {
// doPlaylistTests(t, apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
// AppModeProduction: false, // required for unified storage
// DisableAnonymous: true,
// APIServerStorageType: "unified", // use the entity api tables
// EnableFeatureToggles: []string{
// featuremgmt.FlagUnifiedStorage,
// featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
// },
// DualWriterDesiredModes: map[string]grafanarest.DualWriterMode{
// "playlist": grafanarest.Mode1,
// },
// }))
// })

t.Run("with dual write (unified storage, mode 2)", func(t *testing.T) {
doPlaylistTests(t, apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for unified storage
DisableAnonymous: true,
Expand All @@ -116,7 +146,34 @@ func TestIntegrationPlaylist(t *testing.T) {
}))
})

t.Run("with dual write (etcd)", func(t *testing.T) {
t.Run("with dual write (etcd, mode 1)", func(t *testing.T) {
// NOTE: running local etcd, that will be wiped clean!
t.Skip("local etcd testing")

helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: true,
DisableAnonymous: true,
APIServerStorageType: "etcd", // requires etcd running on localhost:2379
EnableFeatureToggles: []string{
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
},
DualWriterDesiredModes: map[string]grafanarest.DualWriterMode{
"playlist": grafanarest.Mode1,
},
})

// Clear the collection before starting (etcd)
client := helper.GetResourceClient(apis.ResourceClientArgs{
User: helper.Org1.Admin,
GVR: gvr,
})
err := client.Resource.DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{})
require.NoError(t, err)

doPlaylistTests(t, helper)
})

t.Run("with dual write (etcd, mode 2)", func(t *testing.T) {
// NOTE: running local etcd, that will be wiped clean!
t.Skip("local etcd testing")

Expand Down

0 comments on commit 6a02330

Please sign in to comment.