@@ -21,6 +21,9 @@ import (
2121 "io"
2222 "strings"
2323
24+ "github.com/google/go-cmp/cmp"
25+ "github.com/google/go-cmp/cmp/cmpopts"
26+
2427 "github.com/stretchr/testify/suite"
2528
2629 parser "github.com/haproxytech/config-parser/v5"
@@ -81,7 +84,19 @@ func (suite *CRDTCPSuite) BeforeTest(suiteName, testName string) {
8184func (suite * CRDTCPSuite ) checkFrontend (p parser.Parser , frontendName , param string , value common.ParserData ) {
8285 v , err := p .Get (parser .Frontends , frontendName , param )
8386 suite .Require ().NoError (err , "Could not get Haproxy config parser Frontend %s param %s" , frontendName , param )
84- suite .Equal (value , v , fmt .Sprintf ("Frontend param %s should be equal to %v but is %v" , param , value , v ))
87+
88+ // Sort functions for map[string]XXX
89+ sortBinds := cmpopts .SortSlices (func (a , b types.Bind ) bool {
90+ return a .Path < b .Path
91+ })
92+ areEqual := cmp .Equal (v , value , sortBinds )
93+
94+ if ! areEqual {
95+ diff := cmp .Diff (v , value , sortBinds )
96+ suite .T ().Log (diff )
97+ }
98+
99+ suite .Equal (areEqual , true , fmt .Sprintf ("Frontend param %s should be equal to %v but is %v" , param , value , v ))
85100}
86101
87102func (suite * CRDTCPSuite ) checkBackend (p parser.Parser , backendName , param string , value common.ParserData ) {
0 commit comments