mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
config: add version to labels
Adds OPA version to the config labels, so that the version appears in status updates. Previously, decision logs had a top-level version field. This removes that field because version will be contained in the labels instead. Signed-off-by: Andy Curtis <arcurtis@gmail.com>
This commit is contained in:
committed by
Torin Sandall
parent
b4aecc3c43
commit
778594ec79
@@ -9,6 +9,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -17,8 +18,16 @@ import (
|
||||
"github.com/open-policy-agent/opa/plugins/bundle"
|
||||
"github.com/open-policy-agent/opa/storage/inmem"
|
||||
"github.com/open-policy-agent/opa/util"
|
||||
"github.com/open-policy-agent/opa/version"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
if version.Version == "" {
|
||||
version.Version = "unit-test"
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestPluginStart(t *testing.T) {
|
||||
|
||||
fixture := newTestFixture(t)
|
||||
@@ -37,8 +46,9 @@ func TestPluginStart(t *testing.T) {
|
||||
|
||||
exp := UpdateRequestV1{
|
||||
Labels: map[string]string{
|
||||
"id": "test-instance-id",
|
||||
"app": "example-app",
|
||||
"id": "test-instance-id",
|
||||
"app": "example-app",
|
||||
"version": version.Version,
|
||||
},
|
||||
Bundle: status,
|
||||
}
|
||||
@@ -66,8 +76,9 @@ func TestPluginStartDiscovery(t *testing.T) {
|
||||
|
||||
exp := UpdateRequestV1{
|
||||
Labels: map[string]string{
|
||||
"id": "test-instance-id",
|
||||
"app": "example-app",
|
||||
"id": "test-instance-id",
|
||||
"app": "example-app",
|
||||
"version": version.Version,
|
||||
},
|
||||
Discovery: status,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user