File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package sql
22
33import (
44 "encoding/json"
5+ "sort"
56 "testing"
67
78 "github.com/databrickslabs/terraform-provider-databricks/qa"
@@ -648,3 +649,18 @@ func TestWidgetDelete(t *testing.T) {
648649func TestResourceWidgetCornerCases (t * testing.T ) {
649650 qa .ResourceCornerCases (t , ResourceWidget (), qa .CornerCaseID ("foo/bar" ))
650651}
652+
653+ func TestWidgetParameterSorter (t * testing.T ) {
654+ wp := sortWidgetParameter {
655+ WidgetParameter {Name : "foo" },
656+ WidgetParameter {Name : "bar" },
657+ }
658+
659+ // Widget parameters should be sorted by their name to maintain deterministic ordering.
660+ // Since they are not ordered in the API payload, not ordering them means users would
661+ // see false state mismatches on comparison.
662+ sort .Sort (wp )
663+
664+ assert .Equal (t , "bar" , wp [0 ].Name )
665+ assert .Equal (t , "foo" , wp [1 ].Name )
666+ }
You can’t perform that action at this time.
0 commit comments