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/kindsys/slot_test.go

29 lines
847 B

package kindsys
import (
"sort"
"testing"
"cuelang.org/go/cue/cuecontext"
"github.com/stretchr/testify/require"
)
// This is a brick-dumb test that just ensures slots are being loaded correctly
// from their declarations in .cue files.
//
// If this test fails, it's either because:
// - They're not being loaded correctly - there's a bug in kindsys somewhere, fix it
// - The set of slots names has been modified - update the static list here
func TestSlotsAreLoaded(t *testing.T) {
slots := []string{"Panel", "Query", "DSOptions"}
all := AllSlots(cuecontext.New())
var loadedSlots []string
for k := range all {
loadedSlots = append(loadedSlots, k)
}
sort.Strings(slots)
sort.Strings(loadedSlots)
require.Equal(t, slots, loadedSlots, "slots loaded from cue differs from fixture set - either a bug or fixture needs updating")
}