mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-08 04:18:13 +02:00
reconciler: allow custom comparison function (#4727)
reconciler: allow custom comparison function (#4726) Co-authored-by: Denis Mishin <dmishin@pomerium.com>
This commit is contained in:
parent
da9b14db44
commit
c9583c828c
4 changed files with 19 additions and 9 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||
"github.com/pomerium/pomerium/pkg/protoutil"
|
||||
|
@ -19,6 +20,10 @@ func TestRecords(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
cmpFn := func(a, b *databroker.Record) bool {
|
||||
return proto.Equal(a, b)
|
||||
}
|
||||
|
||||
initial := make(databroker.RecordSetBundle)
|
||||
initial.Add(tr("1", "a", "a-1"))
|
||||
initial.Add(tr("2", "a", "a-2"))
|
||||
|
@ -68,7 +73,7 @@ func TestRecords(t *testing.T) {
|
|||
},
|
||||
})
|
||||
|
||||
modified := initial.GetModified(updated)
|
||||
modified := initial.GetModified(updated, cmpFn)
|
||||
equalJSON(modified, databroker.RecordSetBundle{
|
||||
"a": databroker.RecordSet{
|
||||
"1": tr("1", "a", "a-1-1"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue