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:
Andy Curtis
2019-02-08 14:33:27 -08:00
committed by Torin Sandall
parent b4aecc3c43
commit 778594ec79
7 changed files with 44 additions and 22 deletions
+15 -4
View File
@@ -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,
}