mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
29 lines
635 B
Go
29 lines
635 B
Go
package resource_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
|
)
|
|
|
|
func TestResourceModels(t *testing.T) {
|
|
t.Run("key namespaced path", func(t *testing.T) {
|
|
key := &resource.ResourceKey{}
|
|
require.Equal(t, "__cluster__", key.NamespacedPath())
|
|
|
|
key.Namespace = "ns"
|
|
require.Equal(t, "ns", key.NamespacedPath())
|
|
|
|
key.Group = "ggg"
|
|
require.Equal(t, "ns/ggg", key.NamespacedPath())
|
|
|
|
key.Resource = "rrr"
|
|
require.Equal(t, "ns/ggg/rrr", key.NamespacedPath())
|
|
|
|
key.Name = "nnnn"
|
|
require.Equal(t, "ns/ggg/rrr/nnnn", key.NamespacedPath())
|
|
})
|
|
}
|