fix(pkger): add monotoneX geom type to valid geometries
parent
d16406650b
commit
217eddc87e
|
@ -2753,10 +2753,11 @@ func validPosition(pos string) []validationErr {
|
|||
}
|
||||
|
||||
var geometryTypes = map[string]bool{
|
||||
"line": true,
|
||||
"step": true,
|
||||
"stacked": true,
|
||||
"bar": true,
|
||||
"line": true,
|
||||
"step": true,
|
||||
"stacked": true,
|
||||
"monotoneX": true,
|
||||
"bar": true,
|
||||
}
|
||||
|
||||
func validGeometry(geom string) []validationErr {
|
||||
|
|
|
@ -2528,7 +2528,7 @@ spec:
|
|||
{
|
||||
name: "invalid geom flag",
|
||||
validationErrs: 1,
|
||||
valFields: []string{fieldSpec, "charts[0].geom"},
|
||||
valFields: []string{fieldSpec, fieldDashCharts, fieldChartGeom},
|
||||
pkgStr: `apiVersion: influxdata.com/v2alpha1
|
||||
kind: Dashboard
|
||||
metadata:
|
||||
|
@ -4188,6 +4188,44 @@ func Test_PkgValidationErr(t *testing.T) {
|
|||
assert.Equal(t, "chart kind must be provided", errs[1].Reason)
|
||||
}
|
||||
|
||||
func Test_validGeometry(t *testing.T) {
|
||||
tests := []struct {
|
||||
geom string
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
geom: "line", expected: true,
|
||||
},
|
||||
{
|
||||
geom: "step", expected: true,
|
||||
},
|
||||
{
|
||||
geom: "stacked", expected: true,
|
||||
},
|
||||
{
|
||||
geom: "monotoneX", expected: true,
|
||||
},
|
||||
{
|
||||
geom: "bar", expected: true,
|
||||
},
|
||||
{
|
||||
geom: "rando", expected: false,
|
||||
},
|
||||
{
|
||||
geom: "not a valid geom", expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
fn := func(t *testing.T) {
|
||||
isValid := len(validGeometry(tt.geom)) == 0
|
||||
assert.Equal(t, tt.expected, isValid)
|
||||
}
|
||||
|
||||
t.Run(tt.geom, fn)
|
||||
}
|
||||
}
|
||||
|
||||
type testPkgResourceError struct {
|
||||
name string
|
||||
encoding Encoding
|
||||
|
|
Loading…
Reference in New Issue