@@ -15,7 +15,6 @@ const (
1515
1616func newNodeTestController () * Controller {
1717 var controller = NewController (& spec.ControllerConfig {}, "node-test" )
18- controller .opConfig .NodeReadinessLabel = map [string ]string {readyLabel : readyValue }
1918 return controller
2019}
2120
@@ -36,27 +35,58 @@ var nodeTestController = newNodeTestController()
3635func TestNodeIsReady (t * testing.T ) {
3736 testName := "TestNodeIsReady"
3837 var testTable = []struct {
39- in * v1.Node
40- out bool
38+ in * v1.Node
39+ out bool
40+ readinessLabel map [string ]string
4141 }{
4242 {
43- in : makeNode (map [string ]string {"foo" : "bar" }, true ),
44- out : true ,
43+ in : makeNode (map [string ]string {"foo" : "bar" }, true ),
44+ out : true ,
45+ readinessLabel : map [string ]string {readyLabel : readyValue },
4546 },
4647 {
47- in : makeNode (map [string ]string {"foo" : "bar" }, false ),
48- out : false ,
48+ in : makeNode (map [string ]string {"foo" : "bar" }, false ),
49+ out : false ,
50+ readinessLabel : map [string ]string {readyLabel : readyValue },
4951 },
5052 {
51- in : makeNode (map [string ]string {readyLabel : readyValue }, false ),
52- out : true ,
53+ in : makeNode (map [string ]string {readyLabel : readyValue }, false ),
54+ out : true ,
55+ readinessLabel : map [string ]string {readyLabel : readyValue },
5356 },
5457 {
55- in : makeNode (map [string ]string {"foo" : "bar" , "master" : "true" }, false ),
56- out : true ,
58+ in : makeNode (map [string ]string {"foo" : "bar" , "master" : "true" }, false ),
59+ out : true ,
60+ readinessLabel : map [string ]string {readyLabel : readyValue },
61+ },
62+ {
63+ in : makeNode (map [string ]string {"foo" : "bar" , "master" : "true" }, false ),
64+ out : true ,
65+ readinessLabel : map [string ]string {readyLabel : readyValue },
66+ },
67+ {
68+ in : makeNode (map [string ]string {"foo" : "bar" }, true ),
69+ out : true ,
70+ readinessLabel : map [string ]string {},
71+ },
72+ {
73+ in : makeNode (map [string ]string {"foo" : "bar" }, false ),
74+ out : false ,
75+ readinessLabel : map [string ]string {},
76+ },
77+ {
78+ in : makeNode (map [string ]string {readyLabel : readyValue }, false ),
79+ out : false ,
80+ readinessLabel : map [string ]string {},
81+ },
82+ {
83+ in : makeNode (map [string ]string {"foo" : "bar" , "master" : "true" }, false ),
84+ out : true ,
85+ readinessLabel : map [string ]string {},
5786 },
5887 }
5988 for _ , tt := range testTable {
89+ nodeTestController .opConfig .NodeReadinessLabel = tt .readinessLabel
6090 if isReady := nodeTestController .nodeIsReady (tt .in ); isReady != tt .out {
6191 t .Errorf ("%s: expected response %t doesn't match the actual %t for the node %#v" ,
6292 testName , tt .out , isReady , tt .in )
0 commit comments