mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2026-05-05 22:56:09 +02:00
Plan test for ignoring case when comparing targets
This commit is contained in:
parent
0a9daa9e9b
commit
091b8a8f82
@ -30,6 +30,7 @@ type PlanTestSuite struct {
|
||||
suite.Suite
|
||||
fooV1Cname *endpoint.Endpoint
|
||||
fooV2Cname *endpoint.Endpoint
|
||||
fooV2CnameUppercase *endpoint.Endpoint
|
||||
fooV2TXT *endpoint.Endpoint
|
||||
fooV2CnameNoLabel *endpoint.Endpoint
|
||||
fooV3CnameSameResource *endpoint.Endpoint
|
||||
@ -77,6 +78,14 @@ func (suite *PlanTestSuite) SetupTest() {
|
||||
endpoint.ResourceLabelKey: "ingress/default/foo-v2",
|
||||
},
|
||||
}
|
||||
suite.fooV2CnameUppercase = &endpoint.Endpoint{
|
||||
DNSName: "foo",
|
||||
Targets: endpoint.Targets{"V2"},
|
||||
RecordType: "CNAME",
|
||||
Labels: map[string]string{
|
||||
endpoint.ResourceLabelKey: "ingress/default/foo-v2",
|
||||
},
|
||||
}
|
||||
suite.fooV2TXT = &endpoint.Endpoint{
|
||||
DNSName: "foo",
|
||||
RecordType: "TXT",
|
||||
@ -443,6 +452,27 @@ func (suite *PlanTestSuite) TestIgnoreTXT() {
|
||||
validateEntries(suite.T(), changes.Delete, expectedDelete)
|
||||
}
|
||||
|
||||
func (suite *PlanTestSuite) TestIgnoreTargetCase() {
|
||||
current := []*endpoint.Endpoint{suite.fooV2Cname}
|
||||
desired := []*endpoint.Endpoint{suite.fooV2CnameUppercase}
|
||||
expectedCreate := []*endpoint.Endpoint{}
|
||||
expectedUpdateOld := []*endpoint.Endpoint{}
|
||||
expectedUpdateNew := []*endpoint.Endpoint{}
|
||||
expectedDelete := []*endpoint.Endpoint{}
|
||||
|
||||
p := &Plan{
|
||||
Policies: []Policy{&SyncPolicy{}},
|
||||
Current: current,
|
||||
Desired: desired,
|
||||
}
|
||||
|
||||
changes := p.Calculate().Changes
|
||||
validateEntries(suite.T(), changes.Create, expectedCreate)
|
||||
validateEntries(suite.T(), changes.UpdateNew, expectedUpdateNew)
|
||||
validateEntries(suite.T(), changes.UpdateOld, expectedUpdateOld)
|
||||
validateEntries(suite.T(), changes.Delete, expectedDelete)
|
||||
}
|
||||
|
||||
func (suite *PlanTestSuite) TestRemoveEndpoint() {
|
||||
current := []*endpoint.Endpoint{suite.fooV1Cname, suite.bar192A}
|
||||
desired := []*endpoint.Endpoint{suite.fooV1Cname}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user