Skip to content
Open
Changes from 3 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
35 changes: 34 additions & 1 deletion tests/ocp/sriov/tests/reinstallation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tests

import (
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -145,7 +146,7 @@ var _ = Describe("SRIOV Operator re-installation", Ordered, Label(tsparams.Label
installSriovOperator(sriovNamespace, sriovOperatorgroup, sriovSubscription)

Eventually(sriovoperator.IsSriovDeployed,
time.Minute, tsparams.RetryInterval).
5*time.Minute, tsparams.RetryInterval).
WithArguments(APIClient, SriovOcpConfig.OcpSriovOperatorNamespace).
ShouldNot(HaveOccurred(), "SR-IOV operator is not installed")

Expand Down Expand Up @@ -241,6 +242,14 @@ func removeSriovOperator(sriovNamespace *namespace.Builder) {
}, time.Minute, tsparams.RetryInterval).Should(HaveOccurred(),
"ValidatingWebhook sriov-operator-webhook-config was not removed")

By("Removing SR-IOV network pool configs")

// SriovNetworkPoolConfigs carry a finalizer set by the operator controller.
// They must be deleted while the operator is still running; otherwise the
// finalizer can never be removed and the namespace gets stuck in Terminating.
err = sriov.CleanAllPoolConfigs(APIClient, SriovOcpConfig.SriovOperatorNamespace)
Expect(err).ToNot(HaveOccurred(), "Failed to clean SR-IOV network pool configs")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we have the SR-IOV Pool configs on a cluster?

By("Removing SR-IOV namespace")

err = sriovNamespace.DeleteAndWait(tsparams.DefaultTimeout)
Expand Down Expand Up @@ -276,6 +285,30 @@ func installSriovOperator(sriovNamespace *namespace.Builder,
Expect(err).ToNot(HaveOccurred(),
fmt.Sprintf("Failed to create SR-IOV Subscription %s", sriovSubscription.Definition.Name))

By("Waiting for SR-IOV operator CSV to succeed")

// Mirror deploy_cluster.sh's create_default_soc: wait for CSV Succeeded before
// creating SriovOperatorConfig so the operator controller is up and can handle it.
Eventually(func() bool {
csvList, err := olm.ListClusterServiceVersion(APIClient, sriovNamespace.Definition.Name)
if err != nil || len(csvList) == 0 {
return false
}

for _, csv := range csvList {
if !strings.Contains(csv.Definition.Name, "sriov") {
continue
}

succeeded, err := csv.IsSuccessful()

return err == nil && succeeded
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

return false
}, 5*time.Minute, tsparams.RetryInterval).Should(BeTrue(),
"SR-IOV operator CSV did not reach Succeeded phase within timeout")

By("Creating SR-IOV operator default configuration")

_, err = sriov.NewOperatorConfigBuilder(APIClient, sriovNamespace.Definition.Name).
Expand Down