mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
Add manifest metadata to bundle data (#1079)
Fixes #1062 Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
This commit is contained in:
+2
-1
@@ -303,7 +303,8 @@ func loadFileForAnyType(path string, bs []byte) (interface{}, error) {
|
||||
}
|
||||
|
||||
func loadBundle(bs []byte) (bundle.Bundle, error) {
|
||||
return bundle.Read(bytes.NewBuffer(bs))
|
||||
br := bundle.NewReader(bytes.NewBuffer(bs)).IncludeManifestInData(true)
|
||||
return br.Read()
|
||||
}
|
||||
|
||||
func loadRego(path string, bs []byte) (*RegoFile, error) {
|
||||
|
||||
@@ -186,8 +186,11 @@ func TestLoadBundle(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(testBundle.Data, loaded.Documents) {
|
||||
t.Fatalf("Expected %v but got: %v", testBundle.Data, loaded.Documents)
|
||||
actualData := testBundle.Data
|
||||
actualData["system"] = map[string]interface{}{"bundle": map[string]interface{}{"manifest": map[string]interface{}{"revision": ""}}}
|
||||
|
||||
if !reflect.DeepEqual(actualData, loaded.Documents) {
|
||||
t.Fatalf("Expected %v but got: %v", actualData, loaded.Documents)
|
||||
}
|
||||
|
||||
if !bytes.Equal(testBundle.Modules[0].Raw, loaded.Modules["/x.rego"].Raw) {
|
||||
|
||||
Reference in New Issue
Block a user