11package  routing
22
33import  (
4- 	"errors" 
54	"net" 
65	"os" 
76	"reflect" 
@@ -1003,6 +1002,7 @@ func Test_advertisePodRoute(t *testing.T) {
10031002			"add bgp path for pod cidr using NODE_NAME" ,
10041003			& NetworkRoutingController {
10051004				bgpServer : gobgp .NewBgpServer (),
1005+ 				podCidr :   "172.20.0.0/24" ,
10061006			},
10071007			"node-1" ,
10081008			& v1core.Node {
@@ -1023,6 +1023,7 @@ func Test_advertisePodRoute(t *testing.T) {
10231023			& NetworkRoutingController {
10241024				bgpServer :        gobgp .NewBgpServer (),
10251025				hostnameOverride : "node-1" ,
1026+ 				podCidr :          "172.20.0.0/24" ,
10261027			},
10271028			"" ,
10281029			& v1core.Node {
@@ -1038,40 +1039,43 @@ func Test_advertisePodRoute(t *testing.T) {
10381039			},
10391040			nil ,
10401041		},
1041- 		{
1042- 			"add bgp path for pod cidr without NODE_NAME or hostname override" ,
1043- 			& NetworkRoutingController {
1044- 				bgpServer : gobgp .NewBgpServer (),
1045- 			},
1046- 			"" ,
1047- 			& v1core.Node {
1048- 				ObjectMeta : metav1.ObjectMeta {
1049- 					Name : "node-1" ,
1050- 				},
1051- 				Spec : v1core.NodeSpec {
1052- 					PodCIDR : "172.20.0.0/24" ,
1042+ 		/* disabling tests for now, as node POD cidr is read just once at the starting of the program 
1043+ 		   Tests needs to be adopted to catch the errors when NetworkRoutingController starts 
1044+ 			{ 
1045+ 				"add bgp path for pod cidr without NODE_NAME or hostname override", 
1046+ 				&NetworkRoutingController{ 
1047+ 					bgpServer: gobgp.NewBgpServer(), 
1048+ 				}, 
1049+ 				"", 
1050+ 				&v1core.Node{ 
1051+ 					ObjectMeta: metav1.ObjectMeta{ 
1052+ 						Name: "node-1", 
1053+ 					}, 
1054+ 					Spec: v1core.NodeSpec{ 
1055+ 						PodCIDR: "172.20.0.0/24", 
1056+ 					}, 
10531057				}, 
1058+ 				map[string]bool{}, 
1059+ 				errors.New("Failed to get pod CIDR allocated for the node due to: Failed to identify the node by NODE_NAME, hostname or --hostname-override"), 
10541060			}, 
1055- 			map [string ]bool {},
1056- 			errors .New ("Failed to get pod CIDR allocated for the node due to: Failed to identify the node by NODE_NAME, hostname or --hostname-override" ),
1057- 		},
1058- 		{
1059- 			"node does not have pod cidr set" ,
1060- 			& NetworkRoutingController {
1061- 				bgpServer : gobgp .NewBgpServer (),
1062- 			},
1063- 			"node-1" ,
1064- 			& v1core.Node {
1065- 				ObjectMeta : metav1.ObjectMeta {
1066- 					Name : "node-1" ,
1061+ 			{ 
1062+ 				"node does not have pod cidr set", 
1063+ 				&NetworkRoutingController{ 
1064+ 					bgpServer: gobgp.NewBgpServer(), 
10671065				}, 
1068- 				Spec : v1core.NodeSpec {
1069- 					PodCIDR : "" ,
1066+ 				"node-1", 
1067+ 				&v1core.Node{ 
1068+ 					ObjectMeta: metav1.ObjectMeta{ 
1069+ 						Name: "node-1", 
1070+ 					}, 
1071+ 					Spec: v1core.NodeSpec{ 
1072+ 						PodCIDR: "", 
1073+ 					}, 
10701074				}, 
1075+ 				map[string]bool{}, 
1076+ 				errors.New("node.Spec.PodCIDR not set for node: node-1"), 
10711077			}, 
1072- 			map [string ]bool {},
1073- 			errors .New ("node.Spec.PodCIDR not set for node: node-1" ),
1074- 		},
1078+ 		*/ 
10751079	}
10761080
10771081	for  _ , testcase  :=  range  testcases  {
@@ -1508,6 +1512,7 @@ func Test_AddPolicies(t *testing.T) {
15081512				bgpServer :         gobgp .NewBgpServer (),
15091513				activeNodes :       make (map [string ]bool ),
15101514				nodeAsnNumber :     100 ,
1515+ 				podCidr :           "172.20.0.0/24" ,
15111516			},
15121517			[]* v1core.Node {
15131518				{
@@ -1637,6 +1642,7 @@ func Test_AddPolicies(t *testing.T) {
16371642				bgpEnableInternal : true ,
16381643				bgpServer :         gobgp .NewBgpServer (),
16391644				activeNodes :       make (map [string ]bool ),
1645+ 				podCidr :           "172.20.0.0/24" ,
16401646				globalPeerRouters : []* config.Neighbor {
16411647					{
16421648						Config : config.NeighborConfig {NeighborAddress : "10.10.0.1" },
@@ -1801,6 +1807,7 @@ func Test_AddPolicies(t *testing.T) {
18011807				bgpEnableInternal : false ,
18021808				bgpServer :         gobgp .NewBgpServer (),
18031809				activeNodes :       make (map [string ]bool ),
1810+ 				podCidr :           "172.20.0.0/24" ,
18041811				globalPeerRouters : []* config.Neighbor {
18051812					{
18061813						Config : config.NeighborConfig {NeighborAddress : "10.10.0.1" },
@@ -1952,6 +1959,7 @@ func Test_AddPolicies(t *testing.T) {
19521959				pathPrependAS :     "65100" ,
19531960				bgpServer :         gobgp .NewBgpServer (),
19541961				activeNodes :       make (map [string ]bool ),
1962+ 				podCidr :           "172.20.0.0/24" ,
19551963				globalPeerRouters : []* config.Neighbor {
19561964					{
19571965						Config : config.NeighborConfig {NeighborAddress : "10.10.0.1" },
@@ -2124,6 +2132,7 @@ func Test_AddPolicies(t *testing.T) {
21242132				pathPrependAS :     "65100" ,
21252133				bgpServer :         gobgp .NewBgpServer (),
21262134				activeNodes :       make (map [string ]bool ),
2135+ 				podCidr :           "172.20.0.0/24" ,
21272136				globalPeerRouters : []* config.Neighbor {
21282137					{
21292138						Config : config.NeighborConfig {NeighborAddress : "10.10.0.1" },
0 commit comments