Move prefixes for many packages into the globals package (#3069)

This is a prerequisite for some enhancements to grant validation
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2023-03-10 15:06:39 -05:00
1 parent 6adc0c86b5
commit b76b24a4ad
115 files changed
+796 -729

No files matched your search

+4 -3
View File
@@ -9,6 +9,7 @@ import (
"strings"
"testing"
"github.com/hashicorp/boundary/globals"
"github.com/hashicorp/boundary/internal/db"
"github.com/hashicorp/boundary/internal/kms"
"github.com/hashicorp/boundary/internal/types/scope"
@@ -26,7 +27,7 @@ func TestTestKmsWorker(t *testing.T) {
)
tWorker := TestKmsWorker(t, conn, wrapper, WithName(name), WithDescription(description), WithAddress(address), WithOperationalState(ShutdownOperationalState.String()))
assert.NotNil(t, tWorker)
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), WorkerPrefix))
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), globals.WorkerPrefix))
lkpWorker := NewWorker(scope.Global.String())
lkpWorker.PublicId = tWorker.GetPublicId()
@@ -52,7 +53,7 @@ func TestTestPkiWorker(t *testing.T) {
)
tWorker := TestPkiWorker(t, conn, wrapper, WithName(name), WithDescription(description))
assert.NotNil(t, tWorker)
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), WorkerPrefix))
assert.True(t, strings.HasPrefix(tWorker.GetPublicId(), globals.WorkerPrefix))
lkpWorker := NewWorker(scope.Global.String())
lkpWorker.PublicId = tWorker.GetPublicId()
@@ -67,6 +68,6 @@ func TestTestPkiWorker(t *testing.T) {
var keyId string
authorizedWorker := TestPkiWorker(t, conn, wrapper, WithTestPkiWorkerAuthorizedKeyId(&keyId))
assert.NotNil(t, authorizedWorker)
assert.True(t, strings.HasPrefix(authorizedWorker.GetPublicId(), WorkerPrefix))
assert.True(t, strings.HasPrefix(authorizedWorker.GetPublicId(), globals.WorkerPrefix))
assert.NotEmpty(t, keyId)
}