@@ -6,16 +6,23 @@ import (
66 "fmt"
77 "time"
88
9+ "github.com/openshift-kni/performance-addon-operators/functests/utils/tuned"
10+
911 . "github.com/onsi/ginkgo"
1012 . "github.com/onsi/gomega"
13+ machineconfigv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
1114 olmv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1"
12-
13- v1 "k8s.io/api/core/v1"
15+ corev1 "k8s.io/api/core/v1"
1416 "k8s.io/apimachinery/pkg/types"
1517 "sigs.k8s.io/controller-runtime/pkg/client"
1618
19+ performancev2 "github.com/openshift-kni/performance-addon-operators/api/v2"
20+ testutils "github.com/openshift-kni/performance-addon-operators/functests/utils"
1721 testclient "github.com/openshift-kni/performance-addon-operators/functests/utils/client"
22+ "github.com/openshift-kni/performance-addon-operators/functests/utils/mcps"
1823 "github.com/openshift-kni/performance-addon-operators/functests/utils/namespaces"
24+ "github.com/openshift-kni/performance-addon-operators/functests/utils/nodes"
25+ "github.com/openshift-kni/performance-addon-operators/functests/utils/profiles"
1926)
2027
2128var fromVersion string
@@ -29,13 +36,28 @@ func init() {
2936}
3037
3138var _ = Describe ("[rfe_id:28567][performance] Performance Addon Operator Upgrades" , func () {
39+ var performanceProfile * performancev2.PerformanceProfile
40+ var performanceMCP string
41+ var workerRTNodes []corev1.Node
3242
33- BeforeEach (func () {
43+ testutils . BeforeAll (func () {
3444 subscriptionsList := & olmv1alpha1.SubscriptionList {}
3545 err := testclient .Client .List (context .TODO (), subscriptionsList , & client.ListOptions {Namespace : namespaces .PerformanceOperator })
3646 ExpectWithOffset (1 , err ).ToNot (HaveOccurred (), "Failed getting Subscriptions" )
3747 Expect (len (subscriptionsList .Items )).To (Equal (1 ), fmt .Sprintf ("Unexpected number of Subscriptions found: %v" , len (subscriptionsList .Items )))
3848 subscription = & subscriptionsList .Items [0 ]
49+
50+ workerRTNodes , err = nodes .GetByLabels (testutils .NodeSelectorLabels )
51+ Expect (err ).ToNot (HaveOccurred ())
52+ workerRTNodes , err = nodes .MatchingOptionalSelector (workerRTNodes )
53+ Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf ("error looking for the optional selector: %v" , err ))
54+ Expect (workerRTNodes ).ToNot (BeEmpty (), "cannot find RT enabled worker nodes" )
55+
56+ nodeLabel := testutils .NodeSelectorLabels
57+ performanceProfile , err = profiles .GetByNodeLabels (nodeLabel )
58+ Expect (err ).ToNot (HaveOccurred ())
59+ performanceMCP , err = mcps .GetByProfile (performanceProfile )
60+ Expect (err ).ToNot (HaveOccurred ())
3961 })
4062
4163 It ("[test_id:30876] upgrades performance profile operator" , func () {
@@ -73,7 +95,7 @@ var _ = Describe("[rfe_id:28567][performance] Performance Addon Operator Upgrade
7395 // the W/A deletes OLM related pods to initiate OLM pods restart
7496 By ("Getting OLM pods" )
7597 for _ , labelValue := range []string {"olm-operator" , "catalog-operator" } {
76- olmPods := & v1 .PodList {}
98+ olmPods := & corev1 .PodList {}
7799 Expect (testclient .Client .List (
78100 context .TODO (),
79101 olmPods ,
@@ -95,6 +117,18 @@ var _ = Describe("[rfe_id:28567][performance] Performance Addon Operator Upgrade
95117 csv = getCSV (subscription .Status .CurrentCSV , namespaces .PerformanceOperator )
96118 csvWaitForPhaseWithConditionReason (csv .Name , namespaces .PerformanceOperator , olmv1alpha1 .CSVPhaseSucceeded , olmv1alpha1 .CSVReasonInstallSuccessful )
97119 Expect (csv .ObjectMeta .Annotations ["containerImage" ]).NotTo (Equal (fromImage ))
120+
121+ // it is impossible to predict if it was some changes under generated by PAO KubeletConfig or Tuned
122+ // during the PAO upgrade, so the best we can do here is to wait some time,
123+ // to give other controllers time to notify changes
124+ time .Sleep (2 * time .Minute )
125+ mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdated , corev1 .ConditionTrue )
126+
127+ var workerRTNodesNames []string
128+ for _ , workerRTNode := range workerRTNodes {
129+ workerRTNodesNames = append (workerRTNodesNames , workerRTNode .Name )
130+ }
131+ Expect (tuned .WaitForAppliedCondition (workerRTNodesNames , corev1 .ConditionTrue , 5 * time .Minute ))
98132 })
99133})
100134
0 commit comments