Skip to content

Commit

Permalink
tests, libnet, cloudinit: Use the same argument name for the iface
Browse files Browse the repository at this point in the history
Use `ifaceName` to represent an interface name and rename one of the
functions to use `Iface` instead of `Device`.

Signed-off-by: Edward Haas <[email protected]>
  • Loading branch information
EdDev committed Feb 8, 2024
1 parent 67630fe commit 7adaf08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/libnet/cloudinit/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

package cloudinit

func CreateNetworkDataWithStaticIPsByMac(nicName, macAddress, ipAddress string) string {
func CreateNetworkDataWithStaticIPsByMac(ifaceName, macAddress, ipAddress string) string {
networkData, err := NewNetworkData(
WithEthernet(nicName,
WithEthernet(ifaceName,
WithAddresses(ipAddress),
WithNameserverFromCluster(),
WithMatchingMAC(macAddress),
Expand All @@ -33,9 +33,9 @@ func CreateNetworkDataWithStaticIPsByMac(nicName, macAddress, ipAddress string)
return networkData
}

func CreateNetworkDataWithStaticIPsByDevice(deviceName, ipAddress string) string {
func CreateNetworkDataWithStaticIPsByIface(ifaceName, ipAddress string) string {
networkData, err := NewNetworkData(
WithEthernet(deviceName,
WithEthernet(ifaceName,
WithAddresses(ipAddress),
WithNameserverFromCluster(),
),
Expand Down
2 changes: 1 addition & 1 deletion tests/network/hotplug_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var _ = SIGDescribe("bridge nic-hotplug", func() {
libvmi.WithNetwork(v1.DefaultPodNetwork()),
libvmi.WithInterface(iface),
libvmi.WithNetwork(&net),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByDevice("eth1", ip2+subnetMask)),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByIface("eth1", ip2+subnetMask)),
libvmi.WithNodeAffinityFor(hotPluggedVMI.Status.NodeName))
anotherVmi, err := kubevirt.Client().VirtualMachineInstance(testsuite.GetTestNamespace(anotherVmi)).Create(context.Background(), anotherVmi)
ExpectWithOffset(1, err).ToNot(HaveOccurred())
Expand Down
4 changes: 2 additions & 2 deletions tests/network/vmi_multus.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ var _ = SIGDescribe("[Serial]Multus", Serial, decorators.Multus, func() {
libvmi.WithNetwork(v1.DefaultPodNetwork()),
libvmi.WithInterface(linuxBridgeInterface),
libvmi.WithNetwork(&linuxBridgeNetwork),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByDevice("eth1", ptpSubnetIP2+ptpSubnetMask)),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByIface("eth1", ptpSubnetIP2+ptpSubnetMask)),
libvmi.WithNodeAffinityFor(nodes.Items[0].Name))
vmiTwo, err := virtClient.VirtualMachineInstance(testsuite.GetTestNamespace(vmiTwo)).Create(context.Background(), vmiTwo)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -640,7 +640,7 @@ var _ = SIGDescribe("[Serial]Multus", Serial, decorators.Multus, func() {
targetVmi := libvmi.NewFedora(
libvmi.WithInterface(linuxBridgeInterfaceWithMACSpoofCheck),
libvmi.WithNetwork(libvmi.MultusNetwork(linuxBridgeWithMACSpoofCheckNetwork, linuxBridgeWithMACSpoofCheckNetwork)),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByDevice("eth0", targetVMIPAddress+bridgeSubnetMask)),
libvmi.WithCloudInitNoCloudNetworkData(cloudinit.CreateNetworkDataWithStaticIPsByIface("eth0", targetVMIPAddress+bridgeSubnetMask)),
libvmi.WithNodeAffinityFor(nodes.Items[0].Name))
targetVmi, err = virtClient.VirtualMachineInstance(testsuite.GetTestNamespace(targetVmi)).Create(context.Background(), targetVmi)
ExpectWithOffset(1, err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 7adaf08

Please sign in to comment.