@@ -21,6 +21,9 @@ import (
21
21
"io"
22
22
"strings"
23
23
24
+ "github.com/google/go-cmp/cmp"
25
+ "github.com/google/go-cmp/cmp/cmpopts"
26
+
24
27
"github.com/stretchr/testify/suite"
25
28
26
29
parser "github.com/haproxytech/config-parser/v5"
@@ -81,7 +84,19 @@ func (suite *CRDTCPSuite) BeforeTest(suiteName, testName string) {
81
84
func (suite * CRDTCPSuite ) checkFrontend (p parser.Parser , frontendName , param string , value common.ParserData ) {
82
85
v , err := p .Get (parser .Frontends , frontendName , param )
83
86
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 ))
85
100
}
86
101
87
102
func (suite * CRDTCPSuite ) checkBackend (p parser.Parser , backendName , param string , value common.ParserData ) {
0 commit comments