Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: Fix Debug logging should be visible in multus pod flake #611

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two comments:

  1. can we call waitForNetAttachDef(...) in L841 as well ?
  2. we now wait 10 seconds and not 30 when muliplier is 0 , if it doesnt fail i guess that is ok.

Copy link
Member Author

@zeeke zeeke Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two comments:

  1. can we call waitForNetAttachDef(...) in L841 as well ?

sure! didn't see it

  1. we now wait 10 seconds and not 30 when muliplier is 0 , if it doesnt fail i guess that is ok.

I found no reason for having 30s instead of 10s:

I'd go with this and see if it flakes.

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())
adrianchiris marked this conversation as resolved.
Show resolved Hide resolved
}
Loading