feat(bsr): add bsr kms support in config, dev and tests

This commit is contained in:
Jim authored and Timothy Messier committed 2023-05-31 12:18:10 +00:00
1 parent a8574621c7
commit 20cf521cc0
10 files changed
+99 -7

No files matched your search

+1
View File
@@ -290,6 +290,7 @@ func New(ctx context.Context, conf *Config) (*Controller, error) {
kms.WithRootWrapper(c.conf.RootKms),
kms.WithWorkerAuthWrapper(c.conf.WorkerAuthKms),
kms.WithRecoveryWrapper(c.conf.RecoveryKms),
kms.WithBsrWrapper(c.conf.BsrKms),
); err != nil {
return nil, fmt.Errorf("error adding config keys to kms: %w", err)
}
+7
View File
@@ -437,6 +437,9 @@ type TestControllerOpts struct {
// The downstream worker auth KMS to use, or one will be created
DownstreamWorkerAuthKms *multi.PooledWrapper
// The BSR wrapper to use, or one will be created
BsrKms wrapping.Wrapper
// The recovery KMS to use, or one will be created
RecoveryKms wrapping.Wrapper
@@ -692,6 +695,9 @@ func TestControllerConfig(t testing.TB, ctx context.Context, tc *TestController,
if opts.DownstreamWorkerAuthKms != nil {
tc.b.DownstreamWorkerAuthKms = opts.DownstreamWorkerAuthKms
}
if opts.BsrKms != nil {
tc.b.BsrKms = opts.BsrKms
}
if opts.RecoveryKms != nil {
tc.b.RecoveryKms = opts.RecoveryKms
}
@@ -800,6 +806,7 @@ func (tc *TestController) AddClusterControllerMember(t testing.TB, opts *TestCon
RootKms: tc.c.conf.RootKms,
WorkerAuthKms: tc.c.conf.WorkerAuthKms,
DownstreamWorkerAuthKms: tc.c.conf.DownstreamWorkerAuthKms,
BsrKms: tc.c.conf.BsrKms,
RecoveryKms: tc.c.conf.RecoveryKms,
Name: opts.Name,
Logger: tc.c.conf.Logger,
@@ -85,4 +85,17 @@ func Test_TestController(t *testing.T) {
require.NoError(err)
assert.Equal(testLdapAuthMethodId, got.GetPublicId())
})
t.Run("controller-external-wrappers", func(t *testing.T) {
testCtx := context.Background()
assert := assert.New(t)
tc := NewTestController(t, nil)
defer tc.Shutdown()
ws := tc.Kms().GetExternalWrappers(testCtx)
assert.NotNil(ws.Root())
assert.NotNil(ws.WorkerAuth())
assert.NotNil(ws.Recovery())
assert.NotNil(ws.Bsr())
})
}