mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-31 07:19:16 +02:00
databroker: refactor databroker to sync all changes (#1879)
* refactor backend, implement encrypted store * refactor in-memory store * wip * wip * wip * add syncer test * fix redis expiry * fix linting issues * fix test by skipping non-config records * fix backoff import * fix init issues * fix query * wait for initial sync before starting directory sync * add type to SyncLatest * add more log messages, fix deadlock in in-memory store, always return server version from SyncLatest * update sync types and tests * add redis tests * skip macos in github actions * add comments to proto * split getBackend into separate methods * handle errors in initVersion * return different error for not found vs other errors in get * use exponential backoff for redis transaction retry * rename raw to result * use context instead of close channel * store type urls as constants in databroker * use timestampb instead of ptypes * fix group merging not waiting * change locked names * update GetAll to return latest record version * add method to grpcutil to get the type url for a protobuf type
This commit is contained in:
parent
b1871b0f2e
commit
5d60cff21e
66 changed files with 2762 additions and 2871 deletions
|
@ -7,9 +7,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
"github.com/pomerium/pomerium/config"
|
||||
configpb "github.com/pomerium/pomerium/pkg/grpc/config"
|
||||
|
@ -24,7 +24,7 @@ func TestConfigSource(t *testing.T) {
|
|||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
defer li.Close()
|
||||
defer func() { _ = li.Close() }()
|
||||
|
||||
dataBrokerServer := New()
|
||||
srv := grpc.NewServer()
|
||||
|
@ -45,7 +45,7 @@ func TestConfigSource(t *testing.T) {
|
|||
})
|
||||
cfgs <- src.GetConfig()
|
||||
|
||||
data, _ := ptypes.MarshalAny(&configpb.Config{
|
||||
data, _ := anypb.New(&configpb.Config{
|
||||
Name: "config",
|
||||
Routes: []*configpb.Route{
|
||||
{
|
||||
|
@ -54,10 +54,12 @@ func TestConfigSource(t *testing.T) {
|
|||
},
|
||||
},
|
||||
})
|
||||
_, _ = dataBrokerServer.Set(ctx, &databroker.SetRequest{
|
||||
Type: configTypeURL,
|
||||
Id: "1",
|
||||
Data: data,
|
||||
_, _ = dataBrokerServer.Put(ctx, &databroker.PutRequest{
|
||||
Record: &databroker.Record{
|
||||
Type: data.TypeUrl,
|
||||
Id: "1",
|
||||
Data: data,
|
||||
},
|
||||
})
|
||||
|
||||
select {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue