Skip to content

Commit

Permalink
Merge pull request #611 from zeeke/e2e-debug-loggin-flake
Browse files Browse the repository at this point in the history
e2e: Fix `Debug logging should be visible in multus pod` flake
  • Loading branch information
adrianchiris authored Feb 4, 2024
2 parents e409337 + 20c08f5 commit 1e58de4
Showing 1 changed file with 19 additions and 40 deletions.
59 changes: 19 additions & 40 deletions test/conformance/tests/test_sriov_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv4
err := network.CreateSriovNetwork(clients, sriovDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)

pod := createTestPod(node, []string{sriovNetworkName, sriovNetworkName})
nics, err := network.GetNicsByPrefix(pod, "net")
Expand All @@ -795,10 +792,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv6
err := network.CreateSriovNetwork(clients, sriovDevice, ipv6NetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: ipv6NetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(ipv6NetworkName, namespaces.Test)

pod := createTestPod(node, []string{ipv6NetworkName})
ips, err := network.GetSriovNicIPs(pod, "net1")
Expand Down Expand Up @@ -826,10 +820,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv4
err = network.CreateSriovNetwork(clients, sriovDevice, sriovNetworkName, ns1, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: ns1}, netAttDef)
}, (30+snoTimeoutMultiplier*90)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, ns1)

body, _ := json.Marshal([]patchBody{{
Op: "replace",
Expand All @@ -838,10 +829,8 @@ var _ = Describe("[sriov] operator", func() {
}})
clients.SriovnetworkV1Interface.RESTClient().Patch(types.JSONPatchType).Namespace(operatorNamespace).Resource("sriovnetworks").Name(sriovNetworkName).Body(body).Do(context.Background())

Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: ns2}, netAttDef)
}, (30+snoTimeoutMultiplier*90)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, ns2)

Consistently(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: ns1}, netAttDef)
Expand Down Expand Up @@ -891,10 +880,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv4
err := network.CreateSriovNetwork(clients, sriovDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)

macvlanNadName := "macvlan-nad"
macvlanNad := network.CreateMacvlanNetworkAttachmentDefinition(macvlanNadName, namespaces.Test)
Expand Down Expand Up @@ -934,10 +920,7 @@ var _ = Describe("[sriov] operator", func() {
}
err := network.CreateSriovNetwork(clients, sriovDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam, []network.SriovNetworkOptions{config}...)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)

testPod := createTestPod(node, []string{sriovNetworkName})
stdout, _, err := pod.ExecCommand(clients, testPod, "more", "/proc/sys/net/ipv4/conf/net1/accept_redirects")
Expand All @@ -964,10 +947,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv6
err = network.CreateSriovNetwork(clients, sriovDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)

testPodA := pod.RedefineWithNodeSelector(
pod.DefineWithNetworks([]string{sriovNetworkName, sriovNetworkName, sriovNetworkName, sriovNetworkName, sriovNetworkName}),
Expand Down Expand Up @@ -1031,6 +1011,7 @@ var _ = Describe("[sriov] operator", func() {
sn.Spec.LogLevel = "debug"
})
Expect(err).ToNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)

podDeployTime := time.Now()

Expand Down Expand Up @@ -1381,10 +1362,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv4
err := network.CreateSriovNetwork(clients, mainDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)
createTestPod(nodeToTest, []string{sriovNetworkName})
})
})
Expand Down Expand Up @@ -1430,10 +1408,7 @@ var _ = Describe("[sriov] operator", func() {

err = network.CreateSriovNetwork(clients, unusedSriovDevice, sriovNetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: sriovNetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(sriovNetworkName, namespaces.Test)
changeNodeInterfaceState(testNode, unusedSriovDevice.Name, false)
pod := createTestPod(testNode, []string{sriovNetworkName})
ips, err := network.GetSriovNicIPs(pod, "net1")
Expand Down Expand Up @@ -1794,10 +1769,7 @@ var _ = Describe("[sriov] operator", func() {
ipam := ipamIpv4
err = network.CreateSriovNetwork(clients, &nic, ipv6NetworkName, namespaces.Test, operatorNamespace, resourceName, ipam)
Expect(err).ToNot(HaveOccurred())
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: ipv6NetworkName, Namespace: namespaces.Test}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
waitForNetAttachDef(ipv6NetworkName, namespaces.Test)

By("creating a pod")
pod := createTestPod(node, []string{ipv6NetworkName})
Expand Down Expand Up @@ -2719,3 +2691,10 @@ func getMultusPodLogs(nodeName string, since time.Time) []string {

return strings.Split(string(rawLogs), "\n")
}

func waitForNetAttachDef(name, namespace string) {
Eventually(func() error {
netAttDef := &netattdefv1.NetworkAttachmentDefinition{}
return clients.Get(context.Background(), runtimeclient.ObjectKey{Name: name, Namespace: namespace}, netAttDef)
}, (10+snoTimeoutMultiplier*110)*time.Second, 1*time.Second).ShouldNot(HaveOccurred())
}

0 comments on commit 1e58de4

Please sign in to comment.