Skip to content

Commit

Permalink
Correctly search for namespace path, not id (#20651)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
  • Loading branch information
cipherboy authored May 18, 2023
1 parent db5f416 commit 7ec3daa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions builtin/logical/pki/acme_billing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ func validateClientCount(t *testing.T, client *api.Client, mount string, expecte
// Validate this mount's namespace is included in the namespaces list,
// if this is enterprise. Otherwise, if its OSS or we don't have a
// namespace, we default to the value root.
mountNamespace := "root"
mountNamespace := ""
mountPath := mount + "/"
if constants.IsEnterprise && strings.Contains(mount, "/") {
pieces := strings.Split(mount, "/")
require.Equal(t, 2, len(pieces), "we do not support nested namespaces in this test")
mountNamespace = pieces[0]
mountNamespace = pieces[0] + "/"
mountPath = pieces[1] + "/"
}

Expand All @@ -161,11 +161,11 @@ func validateClientCount(t *testing.T, client *api.Client, mount string, expecte
foundNamespace := false
for index, namespaceRaw := range monthlyNamespaces {
namespace := namespaceRaw.(map[string]interface{})
require.Contains(t, namespace, "namespace_id", "expected monthly.namespaces[%v] to contain a namespace_id key", index)
namespaceId := namespace["namespace_id"].(string)
require.Contains(t, namespace, "namespace_path", "expected monthly.namespaces[%v] to contain a namespace_path key", index)
namespacePath := namespace["namespace_path"].(string)

if namespaceId != mountNamespace {
t.Logf("skipping non-matching namespace %v: %v != %v / %v", index, namespaceId, mountNamespace, namespace)
if namespacePath != mountNamespace {
t.Logf("skipping non-matching namespace %v: %v != %v / %v", index, namespacePath, mountNamespace, namespace)
continue
}

Expand Down

0 comments on commit 7ec3daa

Please sign in to comment.