Skip to content

Instantly share code, notes, and snippets.

@willbeason
Created May 27, 2022 18:05
Show Gist options
  • Save willbeason/096da0c673b02f06bd29403d4629e249 to your computer and use it in GitHub Desktop.
Save willbeason/096da0c673b02f06bd29403d4629e249 to your computer and use it in GitHub Desktop.
~/opa$ go test github.com/open-policy-agent/opa/plugins/bundle
time="2022-05-27T18:05:09Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=info msg="Starting bundle loader." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=info msg="Stopping bundle loader." name=test-bundle plugin=bundle
time="2022-05-27T18:05:09Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:33885/opa-test/test-bundle\": context canceled" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: unknown error" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
--- FAIL: TestPluginOneShotBundlePersistence (0.00s)
plugin_test.go:454: expected the downloaded bundle to be equal to the one loaded from disk
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: unknown error" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
--- FAIL: TestPluginOneShotSignedBundlePersistence (0.00s)
plugin_test.go:559: expected the downloaded bundle to be equal to the one loaded from disk
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: /bar/policy.rego:9: rego_type_error: undefined function data.foo.is_one" name=test-bundle-main plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: 3:1: rego_unsafe_var_error: var x is unsafe" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: 2:1: rego_compile_error: conflicting rule for data path foo/p found" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: server replied with Forbidden" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: detected overlapping roots in bundle manifest with: [test-bundle1]" name=test-bundle3 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle3 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: detected overlapping roots in bundle manifest with: [test-bundle1 test-bundle2]" name=test-bundle3 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: detected overlapping roots in bundle manifest with: [test-bundle1]" name=test-bundle2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: 2:1: rego_unsafe_var_error: var x is unsafe" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: some error" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: 2:1: rego_unsafe_var_error: var x is unsafe" name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle activation failed: 1 error occurred: not_scoped:2: rego_type_error: undefined function data.a.a4.func" name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loaded and activated successfully." name=test-bundle plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=bundle.tar.gz plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle.tar.gz\": context canceled" name=bundle.tar.gz plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=bundle.tar.gz plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle.tar.gz\": context canceled" name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle1.tar.gz\": context canceled" name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b1 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle2.tar.gz\": context canceled" name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/new/path/bundles/bundle2.tar.gz\": context canceled" name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b4 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b5 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b3 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle5.tar.gz\": context canceled" name=b5 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundle3.tar.gz\": context canceled" name=b3 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b5 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b3 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundles/bundle4.tar.gz\": context canceled" name=b4 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/new/path/bundles/bundle2.tar.gz\": context canceled" name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b4 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/update2/bundle4.tar.gz\": context canceled" name=b4 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/update2/bundle2.tar.gz\": context canceled" name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b4 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b2 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundle6.tar.gz\": context canceled" name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b7 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b8 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/update3/bundle6.tar.gz\": context canceled" name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundle7.tar.gz\": context canceled" name=b7 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b7 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundle8.tar.gz\": context canceled" name=b8 plugin=bundle
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/update4/bundle6.tar.gz\": context canceled" name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration removed. Stopping bundle loader." name=b6 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="Bundle loader configuration changed. Restarting bundle loader." name=b8 plugin=bundle
time="2022-05-27T18:05:12Z" level=info msg="New bundle loader configuration added. Starting bundle loader." name=b9 plugin=bundle
--- FAIL: TestPluginRequestVsDownloadTimestamp (0.00s)
time="2022-05-27T18:05:12Z" level=error msg="Bundle load failed: request failed: Get \"http://127.0.0.1:46325/opa-test/bundle9.tar.gz\": dial tcp 127.0.0.1:46325: connect: connection refused" name=b9 plugin=bundle
panic: assignment to entry in nil map [recovered]
panic: assignment to entry in nil map
goroutine 26 [running]:
testing.tRunner.func1.2({0xe5cf60, 0x10c98a0})
/usr/lib/google-golang/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
/usr/lib/google-golang/src/testing/testing.go:1392 +0x39f
panic({0xe5cf60, 0x10c98a0})
/usr/lib/google-golang/src/runtime/panic.go:838 +0x207
github.com/open-policy-agent/opa/storage/inmem.(*update).Apply(0xc006dd1350, {0xe57a20, 0x0})
/usr/local/google/home/willbeason/opa/storage/inmem/txn.go:378 +0x107
github.com/open-policy-agent/opa/storage/inmem.(*transaction).Write(0xc0001551a0, 0x0, {0xc000150580?, 0x1, 0x4}, {0xe57a20, 0xc006dd1320})
/usr/local/google/home/willbeason/opa/storage/inmem/txn.go:115 +0x745
github.com/open-policy-agent/opa/storage/inmem.(*store).Write(0x10d4f78?, {0xc000150300?, 0x10caa20?}, {0x10caa20?, 0xc0001551a0?}, 0x0?, {0xc000150580, 0x1, 0x4}, {0xe57a20, ...})
/usr/local/google/home/willbeason/opa/storage/inmem/inmem.go:196 +0xb5
github.com/open-policy-agent/opa/storage.MakeDir({0x10d08d8, 0xc000126618}, {0x10d4f78, 0xc000150300}, {0x10caa20, 0xc0001551a0}, {0xc000150580, 0x1, 0x4})
/usr/local/google/home/willbeason/opa/storage/storage.go:75 +0x211
github.com/open-policy-agent/opa/storage.MakeDir({0x10d08d8, 0xc000126618}, {0x10d4f78, 0xc000150300}, {0x10caa20, 0xc0001551a0}, {0xc000150580, 0x2, 0x4})
/usr/local/google/home/willbeason/opa/storage/storage.go:71 +0x199
github.com/open-policy-agent/opa/storage.MakeDir({0x10d08d8, 0xc000126618}, {0x10d4f78, 0xc000150300}, {0x10caa20, 0xc0001551a0}, {0xc000150580, 0x3, 0x4})
/usr/local/google/home/willbeason/opa/storage/storage.go:71 +0x199
github.com/open-policy-agent/opa/bundle.write({0x10d08d8, 0xc000126618}, {0x10d4f78, 0xc000150300?}, {0x10caa20, 0xc0001551a0}, {0xc000150580, 0x4, 0x4}, {0xf0a7a0, ...})
/usr/local/google/home/willbeason/opa/bundle/store.go:102 +0x116
github.com/open-policy-agent/opa/bundle.WriteManifestToStore(...)
/usr/local/google/home/willbeason/opa/bundle/store.go:84
github.com/open-policy-agent/opa/bundle.writeManifestToStore(0xc0003db428, {0xf5646e?, 0xb?}, {{0x0, 0x0}, 0xc00000e240, {0x0, 0x0, 0x0}, 0x0})
/usr/local/google/home/willbeason/opa/bundle/store.go:573 +0x27a
github.com/open-policy-agent/opa/bundle.activateBundles(0xc0003db428)
/usr/local/google/home/willbeason/opa/bundle/store.go:411 +0x905
github.com/open-policy-agent/opa/bundle.Activate(...)
/usr/local/google/home/willbeason/opa/bundle/store.go:309
github.com/open-policy-agent/opa/plugins/bundle.(*Plugin).activate.func1({0x10caa20, 0xc0001551a0})
/usr/local/google/home/willbeason/opa/plugins/bundle/plugin.go:600 +0x445
github.com/open-policy-agent/opa/storage.Txn({0x10d08d8, 0xc000126618}, {0x10d4f78, 0xc000150300}, {0x1?, 0xc000486058?}, 0xc000329590)
/usr/local/google/home/willbeason/opa/storage/storage.go:95 +0xd1
github.com/open-policy-agent/opa/plugins/bundle.(*Plugin).activate(0xc006db2000, {0x10d08d8, 0xc000126618}, {0xf5646e, 0xb}, 0xc006da21e0)
/usr/local/google/home/willbeason/opa/plugins/bundle/plugin.go:567 +0x298
github.com/open-policy-agent/opa/plugins/bundle.(*Plugin).process(0xc006db2000, {0x10d08d8, 0xc000126618}, {0xf5646e, 0xb}, {{0x0, 0x0}, 0xc006da21e0, {0x0, 0x0}, ...})
/usr/local/google/home/willbeason/opa/plugins/bundle/plugin.go:496 +0x5f0
github.com/open-policy-agent/opa/plugins/bundle.(*Plugin).oneShot(0xc006db2000, {0x10d08d8?, 0xc000126618?}, {0xf5646e, 0xb}, {{0x0, 0x0}, 0xc006da21e0, {0x0, 0x0}, ...})
/usr/local/google/home/willbeason/opa/plugins/bundle/plugin.go:447 +0x159
github.com/open-policy-agent/opa/plugins/bundle.TestPluginRequestVsDownloadTimestamp(0xc006d844e0)
/usr/local/google/home/willbeason/opa/plugins/bundle/plugin_test.go:2006 +0x50b
testing.tRunner(0xc006d844e0, 0xfb6aa0)
/usr/lib/google-golang/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
/usr/lib/google-golang/src/testing/testing.go:1486 +0x35f
FAIL github.com/open-policy-agent/opa/plugins/bundle 3.187s
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment