reconciler: allow custom comparison function (#4726)

This commit is contained in:
Denis Mishin 2023-11-08 20:11:49 -05:00 committed by GitHub
parent ab7b66691d
commit cc6592b6fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 9 deletions

View file

@ -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"),