From 66c0f152d9eabdd5f0a8ccc60821d51c25f4ffc8 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 2 Nov 2023 13:12:20 -0400 Subject: [PATCH] Revert "test(globals): Fix failing tests" (#3983) This reverts commit 274aca755f70d45a4f3c397ca8a5375f39c70fb2. --- globals/prefixes.go | 6 +----- globals/prefixes_test.go | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/globals/prefixes.go b/globals/prefixes.go index 0316ba71c7..4abaea5bbd 100644 --- a/globals/prefixes.go +++ b/globals/prefixes.go @@ -311,11 +311,7 @@ var resourceTypeToPrefixes map[resource.Type][]string = func() map[resource.Type func ResourceInfoFromPrefix(in string) ResourceInfo { // If full ID, trim to just prefix in, _, _ = strings.Cut(in, "_") - res, ok := prefixToResourceType[in] - if !ok { - return ResourceInfo{Type: resource.Unknown} - } - return res + return prefixToResourceType[in] } // ResourcePrefixesFromType returns the known prefixes for a given type; if a diff --git a/globals/prefixes_test.go b/globals/prefixes_test.go index 2b5e08db8a..9c56287366 100644 --- a/globals/prefixes_test.go +++ b/globals/prefixes_test.go @@ -20,10 +20,9 @@ func TestResourceInfoFromPrefix(t *testing.T) { JsonCredentialPrefix: resource.Credential, } - assert.Equal(t, resource.Unknown, ResourceInfoFromPrefix("foobar").Type) for prefix, typ := range vals { assert.Equal(t, typ, ResourceInfoFromPrefix(prefix).Type) assert.Equal(t, typ, ResourceInfoFromPrefix(fmt.Sprintf("%s_foobar", prefix)).Type) - assert.Equal(t, resource.Unknown, ResourceInfoFromPrefix(fmt.Sprintf("%sfoobar", prefix)).Type) + assert.Equal(t, resource.Unknown, ResourceInfoFromPrefix(fmt.Sprintf("%sfoobar", prefix))) } }