mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-11 07:12:59 +02:00
reconciler: allow custom comparison function (#4726)
This commit is contained in:
parent
ab7b66691d
commit
cc6592b6fd
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