@@ -42,7 +42,6 @@ const (
4242 batchSize = 10
4343 initPoolSize = 10
4444 ncID = "6a07155a-32d7-49af-872f-1e70ee366dc0"
45- macAddress = "00:11:22:33:44:55"
4645)
4746
4847var dnsservers = []string {"8.8.8.8" , "8.8.4.4" }
@@ -313,29 +312,7 @@ func TestPendingIPsGotUpdatedWhenSyncHostNCVersion(t *testing.T) {
313312 }
314313}
315314
316- func TestSyncHostNCVersion_SkipsNCVersionForPrefixOnNICSwiftV2 (t * testing.T ) {
317- orchestratorTypes := []string {cns .Kubernetes , cns .KubernetesCRD }
318- for _ , orchestratorType := range orchestratorTypes {
319- t .Run (orchestratorType , func (t * testing.T ) {
320- req := createNCReqeustForSyncHostNCVersion (t , macAddress )
321- containerStatus := svc .state .ContainerStatus [req .NetworkContainerid ]
322- //// HostVersion -1 and NC Version 0 and should remain unchanged, should not error
323- svc .SyncHostNCVersion (context .Background (), orchestratorType )
324-
325- // HostVersion and Version should remain unchanged
326- assert .Equal (t , "-1" , containerStatus .HostVersion )
327- assert .Equal (t , "0" , containerStatus .CreateNetworkContainerRequest .Version )
328- })
329- }
330- }
331-
332- func createNCReqeustForSyncHostNCVersion (t * testing.T , macAddresses ... string ) cns.CreateNetworkContainerRequest {
333- var macAddress string
334- if len (macAddresses ) > 0 {
335- macAddress = macAddresses [0 ]
336- } else {
337- macAddress = ""
338- }
315+ func createNCReqeustForSyncHostNCVersion (t * testing.T ) cns.CreateNetworkContainerRequest {
339316 restartService ()
340317 setEnv (t )
341318 setOrchestratorTypeInternal (cns .KubernetesCRD )
@@ -349,7 +326,7 @@ func createNCReqeustForSyncHostNCVersion(t *testing.T, macAddresses ...string) c
349326 secIPConfig := newSecondaryIPConfig (ipAddress , ncVersion )
350327 ipID := uuid .New ()
351328 secondaryIPConfigs [ipID .String ()] = secIPConfig
352- req := createNCReqInternal (t , secondaryIPConfigs , ncID , strconv .Itoa (ncVersion ), macAddress )
329+ req := createNCReqInternal (t , secondaryIPConfigs , ncID , strconv .Itoa (ncVersion ))
353330 return req
354331}
355332
@@ -928,14 +905,7 @@ func validateNetworkRequest(t *testing.T, req cns.CreateNetworkContainerRequest)
928905 }
929906}
930907
931- func generateNetworkContainerRequest (secondaryIps map [string ]cns.SecondaryIPConfig , ncID , ncVersion string , macAddress ... string ) * cns.CreateNetworkContainerRequest {
932- var mac string
933- if len (macAddress ) > 0 {
934- mac = macAddress [0 ]
935- } else {
936- mac = ""
937- }
938-
908+ func generateNetworkContainerRequest (secondaryIps map [string ]cns.SecondaryIPConfig , ncID , ncVersion string ) * cns.CreateNetworkContainerRequest {
939909 var ipConfig cns.IPConfiguration
940910 ipConfig .DNSServers = dnsservers
941911 ipConfig .GatewayIPAddress = gatewayIP
@@ -949,9 +919,6 @@ func generateNetworkContainerRequest(secondaryIps map[string]cns.SecondaryIPConf
949919 NetworkContainerid : ncID ,
950920 IPConfiguration : ipConfig ,
951921 Version : ncVersion ,
952- NetworkInterfaceInfo : cns.NetworkInterfaceInfo {
953- MACAddress : mac ,
954- },
955922 }
956923
957924 ncVersionInInt , _ := strconv .Atoi (ncVersion )
@@ -1078,14 +1045,8 @@ func validateIPAMStateAfterReconcile(t *testing.T, ncReqs []*cns.CreateNetworkCo
10781045 }
10791046}
10801047
1081- func createNCReqInternal (t * testing.T , secondaryIPConfigs map [string ]cns.SecondaryIPConfig , ncID , ncVersion string , macAddresses ... string ) cns.CreateNetworkContainerRequest {
1082- var macAddress string
1083- if len (macAddresses ) > 0 {
1084- macAddress = macAddresses [0 ]
1085- } else {
1086- macAddress = ""
1087- }
1088- req := generateNetworkContainerRequest (secondaryIPConfigs , ncID , ncVersion , macAddress )
1048+ func createNCReqInternal (t * testing.T , secondaryIPConfigs map [string ]cns.SecondaryIPConfig , ncID , ncVersion string ) cns.CreateNetworkContainerRequest {
1049+ req := generateNetworkContainerRequest (secondaryIPConfigs , ncID , ncVersion )
10891050 returnCode := svc .CreateOrUpdateNetworkContainerInternal (req )
10901051 if returnCode != 0 {
10911052 t .Fatalf ("Failed to createNetworkContainerRequest, req: %+v, err: %d" , req , returnCode )
0 commit comments