storage/inmemory: implement patch operation (#4654)

Add a new Patch() method that updates specific fields of an existing
record's data, based on a field mask.

Extract some logic from the existing Get() and Put() methods so it can
be shared with the new Patch() method.
This commit is contained in:
Kenneth Jenkins 2023-11-02 11:03:00 -07:00 committed by GitHub
parent 5f4e13e130
commit 47890e9ee1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 270 additions and 16 deletions

View file

@ -15,6 +15,7 @@ import (
"github.com/pomerium/pomerium/pkg/grpc/databroker"
"github.com/pomerium/pomerium/pkg/storage"
"github.com/pomerium/pomerium/pkg/storage/storagetest"
)
func TestBackend(t *testing.T) {
@ -72,6 +73,9 @@ func TestBackend(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, record)
})
t.Run("patch", func(t *testing.T) {
storagetest.TestBackendPatch(t, ctx, backend)
})
}
func TestExpiry(t *testing.T) {