grafana/pkg/tests/apis/plugins/discovery_test.go

91 lines
1.7 KiB
Go
Raw Normal View History

2025-08-07 01:09:10 +08:00
package plugins
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/util/testutil"
2025-08-07 01:09:10 +08:00
)
func TestIntegrationPluginsIntegrationDiscovery(t *testing.T) {
testutil.SkipIntegrationTestInShortMode(t)
2025-08-07 01:09:10 +08:00
t.Run("discovery", func(t *testing.T) {
helper := setupHelper(t)
disco := helper.GetGroupVersionInfoJSON("plugins.grafana.app")
require.JSONEq(t, `[
{
"version": "v0alpha1",
"freshness": "Current",
"resources": [
{
"resource": "plugininstalls",
"responseKind": {
"group": "",
"kind": "PluginInstall",
"version": ""
},
"scope": "Namespaced",
"singularResource": "plugininstalls",
"subresources": [
{
"responseKind": {
"group": "",
"kind": "PluginInstall",
"version": ""
},
"subresource": "status",
"verbs": [
"get",
"patch",
"update"
]
}
],
"verbs": [
"create",
"delete",
"deletecollection",
"get",
"list",
"patch",
"update",
"watch"
]
},
{
"resource": "pluginmetas",
"responseKind": {
"group": "",
"kind": "PluginMeta",
"version": ""
},
"scope": "Namespaced",
"singularResource": "pluginmeta",
"subresources": [
{
"responseKind": {
"group": "",
"kind": "PluginMeta",
"version": ""
},
"subresource": "status",
"verbs": [
"get",
"patch",
"update"
]
}
],
"verbs": [
"get",
"list"
]
}
]
}
]`, disco)
})
}