@@ -602,12 +602,12 @@ func TestPodIPsIndexedByInterface(t *testing.T) {
602602 "fe80::7" : cns .NewPodInfo ("some-guid-2" , "def-eth0" , "reconcilePod2" , "PodNS2" ),
603603 },
604604 expectedOutput : map [string ]podIPs {
605- "reconcilePod1:PodNS1 " : {
605+ "abc-eth0 " : {
606606 PodInfo : cns .NewPodInfo ("some-guid-1" , "abc-eth0" , "reconcilePod1" , "PodNS1" ),
607607 v4IP : net .IPv4 (10 , 0 , 0 , 6 ),
608608 v6IP : []byte {0xfe , 0x80 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x06 },
609609 },
610- "reconcilePod2:PodNS2 " : {
610+ "def-eth0 " : {
611611 PodInfo : cns .NewPodInfo ("some-guid-2" , "def-eth0" , "reconcilePod2" , "PodNS2" ),
612612 v4IP : net .IPv4 (10 , 0 , 0 , 7 ),
613613 v6IP : []byte {0xfe , 0x80 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0x07 },
@@ -677,7 +677,6 @@ func TestReconcileNCWithExistingStateFromInterfaceID(t *testing.T) {
677677 setEnv (t )
678678 setOrchestratorTypeInternal (cns .KubernetesCRD )
679679 cns .GlobalPodInfoScheme = cns .InterfaceIDPodInfoScheme
680- defer func () { cns .GlobalPodInfoScheme = cns .KubernetesPodInfoScheme }()
681680
682681 secondaryIPConfigs := make (map [string ]cns.SecondaryIPConfig )
683682
@@ -716,52 +715,6 @@ func TestReconcileNCWithExistingStateFromInterfaceID(t *testing.T) {
716715 validateNCStateAfterReconcile (t , req , expectedNcCount + 1 , expectedAssignedPods , nil )
717716}
718717
719- func TestReconcileCNSIPAMWithKubePodInfoProvider (t * testing.T ) {
720- restartService ()
721- setEnv (t )
722- setOrchestratorTypeInternal (cns .KubernetesCRD )
723-
724- secondaryIPConfigs := make (map [string ]cns.SecondaryIPConfig )
725-
726- startingIndex := 6
727- for i := 0 ; i < 4 ; i ++ {
728- ipaddress := "10.0.0." + strconv .Itoa (startingIndex )
729- secIpConfig := newSecondaryIPConfig (ipaddress , - 1 )
730- ipId := uuid .New ()
731- secondaryIPConfigs [ipId .String ()] = secIpConfig
732- startingIndex ++
733- }
734- req := generateNetworkContainerRequest (secondaryIPConfigs , uuid .New ().String (), "-1" )
735-
736- // the following pod info constructors leave container id and interface id blank on purpose.
737- // this is to simulate the information we get from the kube info provider
738- expectedAssignedPods := make (map [string ]cns.PodInfo )
739- expectedAssignedPods ["10.0.0.6" ] = cns .NewPodInfo ("" , "" , "customerpod1" , "PodNS1" )
740-
741- // allocate non-vnet IP for pod in host network
742- expectedAssignedPods ["192.168.0.1" ] = cns .NewPodInfo ("" , "" , "systempod" , "kube-system" )
743-
744- expectedNcCount := len (svc .state .ContainerStatus )
745- returnCode := svc .ReconcileIPAMStateForSwift ([]* cns.CreateNetworkContainerRequest {req }, expectedAssignedPods , & v1alpha.NodeNetworkConfig {
746- Status : v1alpha.NodeNetworkConfigStatus {
747- Scaler : v1alpha.Scaler {
748- BatchSize : batchSize ,
749- ReleaseThresholdPercent : releasePercent ,
750- RequestThresholdPercent : requestPercent ,
751- },
752- },
753- Spec : v1alpha.NodeNetworkConfigSpec {
754- RequestedIPCount : initPoolSize ,
755- },
756- })
757- if returnCode != types .Success {
758- t .Errorf ("Unexpected failure on reconcile with no state %d" , returnCode )
759- }
760-
761- delete (expectedAssignedPods , "192.168.0.1" )
762- validateNCStateAfterReconcile (t , req , expectedNcCount , expectedAssignedPods , nil )
763- }
764-
765718func setOrchestratorTypeInternal (orchestratorType string ) {
766719 fmt .Println ("setOrchestratorTypeInternal" )
767720 svc .state .OrchestratorType = orchestratorType
0 commit comments