mirror of https://github.com/status-im/consul.git
Fix some more Enterprise Normalization issues affecting tests
This commit is contained in:
parent
b5345ea878
commit
2281d883b9
|
@ -539,7 +539,6 @@ func TestIngressGatewayConfigEntry(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectUnchanged: true,
|
|
||||||
},
|
},
|
||||||
"TLS.SDS gateway-level": {
|
"TLS.SDS gateway-level": {
|
||||||
entry: &IngressGatewayConfigEntry{
|
entry: &IngressGatewayConfigEntry{
|
||||||
|
@ -845,7 +844,9 @@ func TestIngressGatewayConfigEntry(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
validateErr: "A service specifying TLS.SDS.CertResource must have at least one item in Hosts (service \"*\" on listener on port 1111)",
|
// Note we don't assert the last part `(service \"*\" on listener on port 1111)`
|
||||||
|
// since the service name is normalized differently on OSS and Ent
|
||||||
|
validateErr: "A service specifying TLS.SDS.CertResource must have at least one item in Hosts",
|
||||||
},
|
},
|
||||||
"TLS.SDS at service level needs a cluster from somewhere": {
|
"TLS.SDS at service level needs a cluster from somewhere": {
|
||||||
entry: &IngressGatewayConfigEntry{
|
entry: &IngressGatewayConfigEntry{
|
||||||
|
@ -870,7 +871,9 @@ func TestIngressGatewayConfigEntry(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
validateErr: "TLS.SDS.ClusterName is required if CertResource is set (service \"foo\" on listener on port 1111)",
|
// Note we don't assert the last part `(service \"foo\" on listener on port 1111)`
|
||||||
|
// since the service name is normalized differently on OSS and Ent
|
||||||
|
validateErr: "TLS.SDS.ClusterName is required if CertResource is set",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/hashicorp/go-msgpack/codec"
|
"github.com/hashicorp/go-msgpack/codec"
|
||||||
"github.com/hashicorp/hcl"
|
"github.com/hashicorp/hcl"
|
||||||
"github.com/mitchellh/copystructure"
|
"github.com/mitchellh/copystructure"
|
||||||
|
@ -2563,7 +2564,18 @@ func testConfigEntryNormalizeAndValidate(t *testing.T, cases map[string]configEn
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.expectUnchanged {
|
if tc.expectUnchanged {
|
||||||
require.Equal(t, beforeNormalize, tc.entry, "Expected Normalize not to change anything")
|
// EnterpriseMeta.Normalize behaves differently in Ent and OSS which
|
||||||
|
// causes an exact comparison to fail. It's still useful to assert that
|
||||||
|
// nothing else changes though during Normalize. So we ignore
|
||||||
|
// EnterpriseMeta Defaults.
|
||||||
|
opts := cmp.Options{
|
||||||
|
cmp.Comparer(func(a, b EnterpriseMeta) bool {
|
||||||
|
return a.IsSame(&b)
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
if diff := cmp.Diff(beforeNormalize, tc.entry, opts); diff != "" {
|
||||||
|
t.Fatalf("expect unchanged after Normalize, got diff:\n%s", diff)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tc.check != nil {
|
if tc.check != nil {
|
||||||
|
|
Loading…
Reference in New Issue