|
|
|
@ -10,8 +10,6 @@ import ( |
|
|
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" |
|
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema" |
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/services/apiserver/options" |
|
|
|
|
"github.com/grafana/grafana/pkg/services/featuremgmt" |
|
|
|
|
"github.com/grafana/grafana/pkg/setting" |
|
|
|
|
"github.com/grafana/grafana/pkg/tests/apis" |
|
|
|
|
"github.com/grafana/grafana/pkg/tests/testinfra" |
|
|
|
@ -28,23 +26,6 @@ func TestMain(m *testing.M) { |
|
|
|
|
testsuite.Run(m) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestIntegrationRequiresDevMode(t *testing.T) { |
|
|
|
|
if testing.Short() { |
|
|
|
|
t.Skip("skipping integration test") |
|
|
|
|
} |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
AppModeProduction: true, // should fail
|
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
APIServerStorageType: options.StorageTypeUnified, // tests local unified storage connection
|
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
|
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
_, err := helper.NewDiscoveryClient().ServerResourcesForGroupVersion("dashboard.grafana.app/v0alpha1") |
|
|
|
|
require.Error(t, err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func runDashboardTest(t *testing.T, helper *apis.K8sTestHelper) { |
|
|
|
|
t.Run("simple crud+list", func(t *testing.T) { |
|
|
|
|
ctx := context.Background() |
|
|
|
@ -119,10 +100,6 @@ func TestIntegrationDashboardsApp(t *testing.T) { |
|
|
|
|
t.Run("with dual writer mode 0", func(t *testing.T) { |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagKubernetesDashboardsAPI, |
|
|
|
|
featuremgmt.FlagKubernetesDashboards, |
|
|
|
|
}, |
|
|
|
|
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{ |
|
|
|
|
"dashboards.dashboard.grafana.app": { |
|
|
|
|
DualWriterMode: 0, |
|
|
|
@ -135,10 +112,6 @@ func TestIntegrationDashboardsApp(t *testing.T) { |
|
|
|
|
t.Run("with dual writer mode 1", func(t *testing.T) { |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagKubernetesDashboardsAPI, |
|
|
|
|
featuremgmt.FlagKubernetesDashboards, |
|
|
|
|
}, |
|
|
|
|
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{ |
|
|
|
|
"dashboards.dashboard.grafana.app": { |
|
|
|
|
DualWriterMode: 1, |
|
|
|
@ -151,10 +124,6 @@ func TestIntegrationDashboardsApp(t *testing.T) { |
|
|
|
|
t.Run("with dual writer mode 2", func(t *testing.T) { |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagKubernetesDashboardsAPI, |
|
|
|
|
featuremgmt.FlagKubernetesDashboards, |
|
|
|
|
}, |
|
|
|
|
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{ |
|
|
|
|
"dashboards.dashboard.grafana.app": { |
|
|
|
|
DualWriterMode: 2, |
|
|
|
@ -167,10 +136,6 @@ func TestIntegrationDashboardsApp(t *testing.T) { |
|
|
|
|
t.Run("with dual writer mode 3", func(t *testing.T) { |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagKubernetesDashboardsAPI, |
|
|
|
|
featuremgmt.FlagKubernetesDashboards, |
|
|
|
|
}, |
|
|
|
|
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{ |
|
|
|
|
"dashboards.dashboard.grafana.app": { |
|
|
|
|
DualWriterMode: 3, |
|
|
|
@ -184,10 +149,6 @@ func TestIntegrationDashboardsApp(t *testing.T) { |
|
|
|
|
t.Skip("skipping test because of authorizer issue") |
|
|
|
|
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{ |
|
|
|
|
DisableAnonymous: true, |
|
|
|
|
EnableFeatureToggles: []string{ |
|
|
|
|
featuremgmt.FlagKubernetesDashboardsAPI, |
|
|
|
|
featuremgmt.FlagKubernetesDashboards, |
|
|
|
|
}, |
|
|
|
|
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{ |
|
|
|
|
"dashboards.dashboard.grafana.app": { |
|
|
|
|
DualWriterMode: 4, |
|
|
|
|