Upsert creates a new KMS and Updates PKI workers (#2187)
This commit is contained in:
25 files changed
+676
-709
No files matched your search
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTestWorker(t *testing.T) {
|
||||
func TestTestKmsWorker(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
wrapper := db.TestWrapper(t)
|
||||
const (
|
||||
@@ -19,7 +19,7 @@ func TestTestWorker(t *testing.T) {
|
||||
description = "test description"
|
||||
address = "test address"
|
||||
)
|
||||
tWorker := TestWorker(t, conn, wrapper, WithName(name), WithDescription(description), WithAddress(address))
|
||||
tWorker := TestKmsWorker(t, conn, wrapper, WithName(name), WithDescription(description), WithAddress(address))
|
||||
assert.NotNil(t, tWorker)
|
||||
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), WorkerPrefix))
|
||||
|
||||
@@ -29,7 +29,30 @@ func TestTestWorker(t *testing.T) {
|
||||
require.NoError(t, rw.LookupById(context.Background(), lkpWorker))
|
||||
assert.NotNil(t, lkpWorker)
|
||||
assert.NotNil(t, lkpWorker.GetLastStatusTime())
|
||||
assert.Equal(t, KmsWorkerType.String(), lkpWorker.GetType())
|
||||
assert.Equal(t, name, lkpWorker.GetName())
|
||||
assert.Equal(t, description, lkpWorker.GetDescription())
|
||||
assert.Equal(t, address, lkpWorker.GetAddress())
|
||||
}
|
||||
|
||||
func TestTestPkiWorker(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
wrapper := db.TestWrapper(t)
|
||||
const (
|
||||
name = "test name"
|
||||
description = "test description"
|
||||
)
|
||||
tWorker := TestPkiWorker(t, conn, wrapper, WithName(name), WithDescription(description))
|
||||
assert.NotNil(t, tWorker)
|
||||
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), WorkerPrefix))
|
||||
|
||||
lkpWorker := NewWorker(scope.Global.String())
|
||||
lkpWorker.PublicId = tWorker.GetPublicId()
|
||||
rw := db.New(conn)
|
||||
require.NoError(t, rw.LookupById(context.Background(), lkpWorker))
|
||||
assert.NotNil(t, lkpWorker)
|
||||
assert.Equal(t, PkiWorkerType.String(), lkpWorker.GetType())
|
||||
assert.Equal(t, name, lkpWorker.GetName())
|
||||
assert.Equal(t, description, lkpWorker.GetDescription())
|
||||
assert.Nil(t, lkpWorker.GetLastStatusTime())
|
||||
}
|
||||
Reference in new issue
Block a user