From d77ddc41b53ca2d31a733104b880eba1dcff730a Mon Sep 17 00:00:00 2001 From: Mike Palmiotto Date: Mon, 11 Nov 2024 17:05:28 -0500 Subject: [PATCH] Move helper funcs out of tests to fix build errors (#28877) * Move helper funcs out of tests to fix build errors * Rename identiy->identity --- vault/identity_store_test.go | 21 ----------------- ...ss.go => identity_store_test_stubs_oss.go} | 0 vault/identity_store_util.go | 23 +++++++++++++++++++ 3 files changed, 23 insertions(+), 21 deletions(-) rename vault/{identiy_store_test_stubs_oss.go => identity_store_test_stubs_oss.go} (100%) diff --git a/vault/identity_store_test.go b/vault/identity_store_test.go index ed3b1208a6..cce4da413c 100644 --- a/vault/identity_store_test.go +++ b/vault/identity_store_test.go @@ -1600,27 +1600,6 @@ func TestEntityStoreLoadingIsDeterministic(t *testing.T) { } } -func makeEntityForPacker(t *testing.T, id string, p *storagepacker.StoragePacker) *identity.Entity { - return &identity.Entity{ - ID: id, - Name: id, - NamespaceID: namespace.RootNamespaceID, - BucketKey: p.BucketKey(id), - } -} - -func attachAlias(t *testing.T, e *identity.Entity, name string, me *MountEntry) *identity.Alias { - a := &identity.Alias{ - ID: name, - Name: name, - CanonicalID: e.ID, - MountType: me.Type, - MountAccessor: me.Accessor, - } - e.UpsertAlias(a) - return a -} - func makeGroupWithIDAndAlias(t *testing.T, id, alias, bucketKey string, me *MountEntry) *identity.Group { g := &identity.Group{ ID: id, diff --git a/vault/identiy_store_test_stubs_oss.go b/vault/identity_store_test_stubs_oss.go similarity index 100% rename from vault/identiy_store_test_stubs_oss.go rename to vault/identity_store_test_stubs_oss.go diff --git a/vault/identity_store_util.go b/vault/identity_store_util.go index b3a6d47748..67d27aa829 100644 --- a/vault/identity_store_util.go +++ b/vault/identity_store_util.go @@ -9,6 +9,7 @@ import ( "fmt" "strings" "sync" + "testing" "time" metrics "github.com/armon/go-metrics" @@ -2628,3 +2629,25 @@ func (i *IdentityStore) countEntitiesByMountAccessor(ctx context.Context) (map[s return byMountAccessor, nil } + +func makeEntityForPacker(_t *testing.T, id string, p *storagepacker.StoragePacker) *identity.Entity { + return &identity.Entity{ + ID: id, + Name: id, + NamespaceID: namespace.RootNamespaceID, + BucketKey: p.BucketKey(id), + } +} + +func attachAlias(t *testing.T, e *identity.Entity, name string, me *MountEntry) *identity.Alias { + t.Helper() + a := &identity.Alias{ + ID: name, + Name: name, + CanonicalID: e.ID, + MountType: me.Type, + MountAccessor: me.Accessor, + } + e.UpsertAlias(a) + return a +}