mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 16:27:28 +02:00
define ownership between operator and clusters via annotation (#802)
* define ownership between operator and postgres clusters * add documentation * add unit test
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/zalando/postgres-operator/pkg/spec"
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
@@ -13,10 +13,10 @@ const (
|
||||
readyValue = "ready"
|
||||
)
|
||||
|
||||
func initializeController() *Controller {
|
||||
var c = NewController(&spec.ControllerConfig{})
|
||||
c.opConfig.NodeReadinessLabel = map[string]string{readyLabel: readyValue}
|
||||
return c
|
||||
func newNodeTestController() *Controller {
|
||||
var controller = NewController(&spec.ControllerConfig{}, "node-test")
|
||||
controller.opConfig.NodeReadinessLabel = map[string]string{readyLabel: readyValue}
|
||||
return controller
|
||||
}
|
||||
|
||||
func makeNode(labels map[string]string, isSchedulable bool) *v1.Node {
|
||||
@@ -31,7 +31,7 @@ func makeNode(labels map[string]string, isSchedulable bool) *v1.Node {
|
||||
}
|
||||
}
|
||||
|
||||
var c = initializeController()
|
||||
var nodeTestController = newNodeTestController()
|
||||
|
||||
func TestNodeIsReady(t *testing.T) {
|
||||
testName := "TestNodeIsReady"
|
||||
@@ -57,7 +57,7 @@ func TestNodeIsReady(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range testTable {
|
||||
if isReady := c.nodeIsReady(tt.in); isReady != tt.out {
|
||||
if isReady := nodeTestController.nodeIsReady(tt.in); isReady != tt.out {
|
||||
t.Errorf("%s: expected response %t doesn't match the actual %t for the node %#v",
|
||||
testName, tt.out, isReady, tt.in)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user