Clean up some dev config kms code (#2321)
* Clean up some dev config kms code Although it didn't matter in the combined state, the KMS for auth storage was not actually being set properly if only a worker was being instantiated.
This commit is contained in:
1 parent
661d6a551e
commit
090b2b28f8
5 files changed
+44
-36
No files matched your search
@@ -85,7 +85,7 @@ func TestRotationTicking(t *testing.T) {
|
||||
require.NoError(err)
|
||||
assert.Len(auths, 1)
|
||||
// Fetch creds and store current key
|
||||
currNodeCreds, err := types.LoadNodeCredentials(w.Context(), w.Worker().WorkerAuthStorage, nodeenrollment.CurrentId)
|
||||
currNodeCreds, err := types.LoadNodeCredentials(w.Context(), w.Worker().WorkerAuthStorage, nodeenrollment.CurrentId, nodeenrollment.WithWrapper(w.Config().WorkerAuthStorageKms))
|
||||
require.NoError(err)
|
||||
currKey := currNodeCreds.CertificatePublicKeyPkix
|
||||
|
||||
@@ -101,7 +101,7 @@ func TestRotationTicking(t *testing.T) {
|
||||
assert.Len(auths, i)
|
||||
|
||||
// Fetch creds and compare current key
|
||||
currNodeCreds, err := types.LoadNodeCredentials(w.Context(), w.Worker().WorkerAuthStorage, nodeenrollment.CurrentId)
|
||||
currNodeCreds, err := types.LoadNodeCredentials(w.Context(), w.Worker().WorkerAuthStorage, nodeenrollment.CurrentId, nodeenrollment.WithWrapper(w.Config().WorkerAuthStorageKms))
|
||||
require.NoError(err)
|
||||
assert.NotEqual(currKey, currNodeCreds.CertificatePublicKeyPkix)
|
||||
currKey = currNodeCreds.CertificatePublicKeyPkix
|
||||
|
||||
@@ -225,6 +225,7 @@ func NewTestWorker(t testing.TB, opts *TestWorkerOpts) *TestWorker {
|
||||
// Base server
|
||||
tw.b = base.NewServer(nil)
|
||||
tw.b.Command = &base.Command{
|
||||
Context: ctx,
|
||||
ShutdownCh: make(chan struct{}),
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,12 @@ func TestTestWorker_WorkerAuthStorageKms(t *testing.T) {
|
||||
tw := NewTestWorker(t, &TestWorkerOpts{
|
||||
WorkerAuthStorageKms: tt.wrapper,
|
||||
})
|
||||
require.Equal(tt.wrapper, tw.Config().WorkerAuthStorageKms)
|
||||
if tt.wrapper == nil {
|
||||
// DevWorker config will create one
|
||||
require.NotNil(tw.Config().WorkerAuthStorageKms)
|
||||
} else {
|
||||
require.Equal(tt.wrapper, tw.Config().WorkerAuthStorageKms)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user