K8s/Playlist: Test dual write path (#77604)
This commit is contained in:
@@ -74,7 +74,6 @@ func NewK8sTestHelper(t *testing.T, opts testinfra.GrafanaOpts) *K8sTestHelper {
|
||||
}
|
||||
|
||||
func (c *K8sTestHelper) Shutdown() {
|
||||
fmt.Printf("calling shutdown on: %s\n", c.env.Server.HTTPServer.Listener.Addr())
|
||||
err := c.env.Server.Shutdown(context.Background(), "done")
|
||||
require.NoError(c.t, err)
|
||||
}
|
||||
|
||||
@@ -75,6 +75,18 @@ func TestPlaylist(t *testing.T) {
|
||||
},
|
||||
}))
|
||||
})
|
||||
|
||||
t.Run("with dual write", 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.FlagGrafanaAPIServer,
|
||||
featuremgmt.FlagKubernetesPlaylists, // Required so that legacy calls are also written
|
||||
},
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
func doPlaylistTests(t *testing.T, helper *apis.K8sTestHelper) *apis.K8sTestHelper {
|
||||
|
||||
@@ -342,6 +342,13 @@ func CreateGrafDir(t *testing.T, opts ...GrafanaOpts) (string, string) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
if o.APIServerStorageType != "" {
|
||||
section, err := getOrCreateSection("grafana-apiserver")
|
||||
require.NoError(t, err)
|
||||
_, err = section.NewKey("storage_type", o.APIServerStorageType)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
if o.GRPCServerAddress != "" {
|
||||
logSection, err := getOrCreateSection("grpc_server")
|
||||
require.NoError(t, err)
|
||||
@@ -397,6 +404,7 @@ type GrafanaOpts struct {
|
||||
EnableLog bool
|
||||
GRPCServerAddress string
|
||||
QueryRetries int64
|
||||
APIServerStorageType string
|
||||
}
|
||||
|
||||
func CreateUser(t *testing.T, store *sqlstore.SQLStore, cmd user.CreateUserCommand) *user.User {
|
||||
|
||||
Reference in New Issue
Block a user