1
0
Fork 0
mirror of https://github.com/pomerium/pomerium.git synced 2025-05-17 02:57:11 +02:00

postgres: fix record deletion ()

This commit is contained in:
Caleb Doxsey 2022-06-24 09:32:44 -06:00 committed by GitHub
parent 270f8b4f2c
commit 1727d178ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions
pkg/storage/postgres

View file

@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/structpb"
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/pomerium/pomerium/internal/testutil"
"github.com/pomerium/pomerium/pkg/grpc/databroker"
@ -44,6 +45,21 @@ func TestBackend(t *testing.T) {
assert.NoError(t, err)
})
t.Run("delete", func(t *testing.T) {
serverVersion, err := backend.Put(ctx, []*databroker.Record{
{
Type: "test-1",
Id: "r3",
Data: protoutil.NewAny(protoutil.NewStructMap(map[string]*structpb.Value{
"k1": protoutil.NewStructString("v1"),
})),
DeletedAt: timestamppb.Now(),
},
})
assert.NotEqual(t, 0, serverVersion)
assert.NoError(t, err)
})
t.Run("capacity", func(t *testing.T) {
err := backend.SetOptions(ctx, "capacity-test", &databroker.Options{
Capacity: proto.Uint64(3),