diff --git a/cmd/inspect_test.go b/cmd/inspect_test.go index 549b62e5f4..41db4d6c41 100644 --- a/cmd/inspect_test.go +++ b/cmd/inspect_test.go @@ -51,7 +51,7 @@ func TestDoInspect(t *testing.T) { res := `{ "manifest": {"revision": "rev", "roots": ["foo", "bar", "fuz", "baz", "a", "x"]}, "signatures_config": {}, - "namespaces": {"": ["/data.json"], "data.foo": ["/example/foo.rego"]} + "namespaces": {"data": ["/data.json"], "data.foo": ["/example/foo.rego"]} }` exp := util.MustUnmarshalJSON([]byte(res)) @@ -131,7 +131,7 @@ NAMESPACES: +-----------------------------+----------------------------------------------------+ | NAMESPACE | FILE | +-----------------------------+----------------------------------------------------+ -| | /data.json | +| data | /data.json | | data.a.b.y | /a/b/y/foo.rego | | | /a/...xxxxxxxxxxxxxx/yyyyyyyyyyyyyyyyyyyy/foo.rego | | data.foo | /example/foo.rego | diff --git a/internal/bundle/inspect/inspect.go b/internal/bundle/inspect/inspect.go index cd7b45bfc2..9d293b74db 100644 --- a/internal/bundle/inspect/inspect.go +++ b/internal/bundle/inspect/inspect.go @@ -126,7 +126,7 @@ func (bi *Info) getBundleDataWasmAndSignatures(name string) error { path := fmt.Sprintf("%v.%v", ast.DefaultRootDocument, strings.Join(key, ".")) bi.Namespaces[path] = append(bi.Namespaces[path], value) } else { - bi.Namespaces[""] = append(bi.Namespaces[""], value) // data file at bundle root + bi.Namespaces[ast.DefaultRootDocument.String()] = append(bi.Namespaces[ast.DefaultRootDocument.String()], value) // data file at bundle root } } diff --git a/internal/bundle/inspect/inspect_test.go b/internal/bundle/inspect/inspect_test.go index 58c8ee0b54..00cc4a21cc 100644 --- a/internal/bundle/inspect/inspect_test.go +++ b/internal/bundle/inspect/inspect_test.go @@ -48,7 +48,7 @@ func TestGenerateBundleInfoWithFileDir(t *testing.T) { } expectedNamespaces := map[string][]string{ - "": {filepath.Join(rootDir, "data.json")}, + "data": {filepath.Join(rootDir, "data.json")}, "data.bar": {filepath.Join(rootDir, "base.rego")}, "data.foo": {filepath.Join(rootDir, "baz/authz.rego"), filepath.Join(rootDir, "foo/policy.rego")}, "data.fuz": {filepath.Join(rootDir, "fuz/fuz.rego"), filepath.Join(rootDir, "fuz/data.json")}, @@ -114,7 +114,7 @@ func TestGenerateBundleInfoWithFile(t *testing.T) { } expectedNamespaces := map[string][]string{ - "": {"/data.json"}, + "data": {"/data.json"}, "data.b.c": {"/policy.rego"}, } @@ -181,7 +181,7 @@ func TestGenerateBundleInfoWithBundleTarGz(t *testing.T) { expectedNamespaces := map[string][]string{ "data.example": {"/example/example.rego"}, - "": {"/data.json"}, + "data": {"/data.json"}, "data.a.b.c": {"/a/b/c/data.json"}, "data.a.b.d": {"/a/b/d/data.json"}, "data.a.b.y": {"/a/b/y/foo.rego", "/a/b/y/data.yaml"},