mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Live: check schema equality between push messages (#34548)
This commit is contained in:
@@ -6,15 +6,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
unstableSchemaParam = "gf_live_unstable_schema"
|
||||
frameFormatParam = "gf_live_frame_format"
|
||||
frameFormatParam = "gf_live_frame_format"
|
||||
)
|
||||
|
||||
// UnstableSchemaFromValues extracts unstable schema tip from url values.
|
||||
func UnstableSchemaFromValues(values url.Values) bool {
|
||||
return strings.ToLower(values.Get(unstableSchemaParam)) == "true" || values.Get(unstableSchemaParam) == "1"
|
||||
}
|
||||
|
||||
// FrameFormatFromValues extracts frame format tip from url values.
|
||||
func FrameFormatFromValues(values url.Values) string {
|
||||
frameFormat := strings.ToLower(values.Get(frameFormatParam))
|
||||
|
||||
@@ -7,17 +7,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestUnstableSchemaFromValues(t *testing.T) {
|
||||
values := url.Values{}
|
||||
require.False(t, UnstableSchemaFromValues(values))
|
||||
values.Set(unstableSchemaParam, "yes")
|
||||
require.False(t, UnstableSchemaFromValues(values))
|
||||
values.Set(unstableSchemaParam, "true")
|
||||
require.True(t, UnstableSchemaFromValues(values))
|
||||
values.Set(unstableSchemaParam, "True")
|
||||
require.True(t, UnstableSchemaFromValues(values))
|
||||
}
|
||||
|
||||
func TestFrameFormatFromValues(t *testing.T) {
|
||||
values := url.Values{}
|
||||
require.Equal(t, "labels_column", FrameFormatFromValues(values))
|
||||
|
||||
Reference in New Issue
Block a user