Skip to content

Commit

Permalink
e2e:irqbalance: wait for tuned profile to be ready (#721)
Browse files Browse the repository at this point in the history
we need to wait for tuned to apply the recent changes,
before we check the irqbalance settings.

we poll the tuned profile and check the applied status.
we failed the test if the status not consolidate to applied
within the timeout value.

Signed-off-by: Talor Itzhak <titzhak@redhat.com>
  • Loading branch information
Tal-or committed Jul 23, 2023
1 parent 1d4b5e5 commit fbd2df9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/e2e/performanceprofile/functests/1_performance/irqbalance.go
Expand Up @@ -18,6 +18,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

tunedv1 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/tuned/v1"
machineconfigv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"

performancev2 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/performanceprofile/v2"
Expand All @@ -31,6 +32,7 @@ import (
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/nodes"
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/pods"
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/profiles"
e2etuned "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/tuned"
"github.com/openshift/cluster-node-tuning-operator/test/e2e/util"
"github.com/openshift/cluster-node-tuning-operator/test/framework"
)
Expand Down Expand Up @@ -89,6 +91,19 @@ var _ = Describe("[performance] Checking IRQBalance settings", Ordered, func() {
}

for _, node := range workerRTNodes {
var condStatus string
Eventually(context.TODO(), func() bool {
tunedProfile, err := e2etuned.GetProfile(context.TODO(), testclient.Client, components.NamespaceNodeTuningOperator, node.Name)
Expect(err).ToNot(HaveOccurred(), "failed to get Tuned Profile for node %q", node.Name)
for _, cond := range tunedProfile.Status.Conditions {
if cond.Type == tunedv1.TunedProfileApplied && cond.Status != corev1.ConditionTrue {
condStatus = string(cond.Status)
return false
}
}
return true
}).WithPolling(time.Second*10).WithTimeout(3*time.Minute).Should(BeTrue(), "Tuned Profile for node %q was not applied successfully conditionStatus=%q", node.Name, condStatus)

By(fmt.Sprintf("verifying worker node %q", node.Name))

bannedCPUs, err := getIrqBalanceBannedCPUs(&node)
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/performanceprofile/functests/utils/tuned/tuned.go
Expand Up @@ -127,3 +127,16 @@ func CheckParameters(node *corev1.Node, sysctlMap map[string]string, kernelParam
ExpectWithOffset(1, err).To(HaveOccurred(), "node should have non-RT kernel")
}
}

func GetProfile(ctx context.Context, cli client.Client, ns, name string) (*tunedv1.Profile, error) {
key := client.ObjectKey{
Namespace: ns,
Name: name,
}
p := &tunedv1.Profile{}
err := cli.Get(ctx, key, p)
if err != nil {
return nil, err
}
return p, nil
}

0 comments on commit fbd2df9

Please sign in to comment.