mirror of https://github.com/hashicorp/boundary
fix (kms): Add kms.ReconcileKeys(...) to fix missing audit DEK scenario (#1711)
This fix addresses the situation where an existing boundary database doesn't have the audit DEKs in the global scope.pull/1716/head
parent
7fa2cd2526
commit
ebea283421
@ -0,0 +1,34 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/kms"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestController_New(t *testing.T) {
|
||||
t.Run("ReconcileKeys", func(t *testing.T) {
|
||||
require := require.New(t)
|
||||
testCtx := context.Background()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
tc := &TestController{
|
||||
t: t,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
opts: nil,
|
||||
}
|
||||
conf := TestControllerConfig(t, ctx, tc, nil)
|
||||
|
||||
// this tests a scenario where there is an audit DEK
|
||||
c, err := New(testCtx, conf)
|
||||
require.NoError(err)
|
||||
|
||||
// this tests a scenario where there is NOT an audit DEK
|
||||
require.NoError(c.conf.Server.Database.Where("1=1").Delete(kms.AllocAuditKey()).Error)
|
||||
_, err = New(testCtx, conf)
|
||||
require.NoError(err)
|
||||
})
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue