The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/tests/apis/dashboardsnapshot/snapshots_test.go

85 lines
1.8 KiB

package dashboardsnapshots
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/tests/apis"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
)
func TestMain(m *testing.M) {
testsuite.Run(m)
}
func TestIntegrationDashboardSnapshots(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental apis
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // required to register dashboardsnapshot.grafana.app
},
})
t.Run("Check discovery client", func(t *testing.T) {
disco := helper.GetGroupVersionInfoJSON("dashboardsnapshot.grafana.app")
// fmt.Printf("%s", disco)
require.JSONEq(t, `[
{
"freshness": "Current",
"resources": [
{
"resource": "dashboardsnapshots",
"responseKind": {
"group": "",
"kind": "DashboardSnapshot",
"version": ""
},
"scope": "Namespaced",
"singularResource": "dashboardsnapshot",
"subresources": [
{
"responseKind": {
"group": "",
"kind": "FullDashboardSnapshot",
"version": ""
},
"subresource": "body",
"verbs": [
"get"
]
}
],
"verbs": [
"delete",
"get",
"list"
]
},
{
"resource": "options",
"responseKind": {
"group": "",
"kind": "SharingOptions",
"version": ""
},
"scope": "Namespaced",
"singularResource": "options",
"verbs": [
"get",
"list"
]
}
],
"version": "v0alpha1"
}
]`, disco)
})
}