@@ -7,17 +7,17 @@ import (
77
88 "github.com/onsi/gomega/gcustom"
99 types2 "github.com/onsi/gomega/types"
10- tunedutils "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/tuned"
10+ // tunedutils "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/tuned"
1111
1212 . "github.com/onsi/ginkgo/v2"
1313 . "github.com/onsi/gomega"
1414 corev1 "k8s.io/api/core/v1"
15- nodev1 "k8s.io/api/node/v1"
15+ // nodev1 "k8s.io/api/node/v1"
1616 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1717 "k8s.io/apimachinery/pkg/runtime"
1818 "k8s.io/apimachinery/pkg/types"
1919 utilrand "k8s.io/apimachinery/pkg/util/rand"
20- "sigs.k8s.io/controller-runtime/pkg/client"
20+ // "sigs.k8s.io/controller-runtime/pkg/client"
2121
2222 ign2types "github.com/coreos/ignition/config/v2_2/types"
2323 machineconfigv1 "github.com/openshift/api/machineconfiguration/v1"
@@ -28,11 +28,12 @@ import (
2828 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/discovery"
2929 hypershiftutils "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/hypershift"
3030 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/label"
31- "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/mcps"
31+ // "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/mcps"
3232 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/nodepools"
3333 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/nodes"
3434 "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/profiles"
3535 v1 "github.com/openshift/custom-resource-status/conditions/v1"
36+ "github.com/openshift/cluster-node-tuning-operator/test/e2e/util"
3637)
3738
3839var _ = Describe ("Status testing of performance profile" , Ordered , func () {
@@ -53,68 +54,68 @@ var _ = Describe("Status testing of performance profile", Ordered, func() {
5354 })
5455
5556 Context ("[rfe_id:28881][performance] Performance Addons detailed status" , Label (string (label .Tier1 )), func () {
56- It ("[test_id:30894] Tuned status name tied to Performance Profile" , func () {
57- profile , err := profiles .GetByNodeLabels (testutils .NodeSelectorLabels )
58- Expect (err ).ToNot (HaveOccurred ())
59- tunedList := & tunedv1.TunedList {}
60- tunedName , err := tunedutils .GetName (context .TODO (), testclient .ControlPlaneClient , profile .Name )
61- Expect (err ).ToNot (HaveOccurred ())
62- tunedNamespacedName := types.NamespacedName {
63- Name : tunedName ,
64- Namespace : components .NamespaceNodeTuningOperator ,
65- }
66- // on hypershift platform, we're getting the tuned object that was mirrored by NTO to the hosted cluster,
67- // hence we're using the DataPlaneClient here.
68- Eventually (func (g Gomega ) {
69- g .Expect (testclient .DataPlaneClient .List (context .TODO (), tunedList , & client.ListOptions {
70- Namespace : tunedNamespacedName .Namespace ,
71- })).To (Succeed ())
72- Expect (tunedList .Items ).To (MatchTunedName (tunedName ))
73- }).WithTimeout (time .Minute ).WithPolling (time .Second * 10 ).Should (Succeed ())
74- Expect (* profile .Status .Tuned ).ToNot (BeNil ())
75- Expect (* profile .Status .Tuned ).To (Equal (tunedNamespacedName .String ()))
76- })
77-
78- It ("[test_id:33791] Should include the generated runtime class name" , func () {
79- profile , err := profiles .GetByNodeLabels (testutils .NodeSelectorLabels )
80- Expect (err ).ToNot (HaveOccurred ())
81-
82- key := types.NamespacedName {
83- Name : components .GetComponentName (profile .Name , components .ComponentNamePrefix ),
84- Namespace : metav1 .NamespaceAll ,
85- }
86- runtimeClass := & nodev1.RuntimeClass {}
87- err = testclient .GetWithRetry (context .TODO (), testclient .DataPlaneClient , key , runtimeClass )
88- Expect (err ).ToNot (HaveOccurred (), "cannot find the RuntimeClass object " + key .String ())
89-
90- Expect (profile .Status .RuntimeClass ).NotTo (BeNil ())
91- Expect (* profile .Status .RuntimeClass ).To (Equal (runtimeClass .Name ))
92- })
93-
94- It ("[test_id:29673] Machine config pools status tied to Performance Profile" , Label (string (label .OpenShift )), func () {
95- // Creating bad MC that leads to degraded state
96- By ("Creating bad MachineConfig" )
97- badMC := createBadMachineConfig ("bad-mc" )
98- err = testclient .ControlPlaneClient .Create (context .TODO (), badMC )
99- Expect (err ).ToNot (HaveOccurred ())
100-
101- By ("Wait for MCP condition to be Degraded" )
102- profile , err := profiles .GetByNodeLabels (testutils .NodeSelectorLabels )
103- Expect (err ).ToNot (HaveOccurred ())
104- performanceMCP , err := mcps .GetByProfile (profile )
105- Expect (err ).ToNot (HaveOccurred ())
106- mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolDegraded , corev1 .ConditionTrue )
107- mcpConditionReason := mcps .GetConditionReason (performanceMCP , machineconfigv1 .MachineConfigPoolDegraded )
108- profileConditionMessage := profiles .GetConditionMessage (testutils .NodeSelectorLabels , v1 .ConditionDegraded )
109- // Verify the status reason of performance profile
110- Expect (profileConditionMessage ).To (ContainSubstring (mcpConditionReason ))
111-
112- By ("Deleting bad MachineConfig and waiting when Degraded state is removed" )
113- err = testclient .ControlPlaneClient .Delete (context .TODO (), badMC )
114- Expect (err ).ToNot (HaveOccurred ())
115-
116- mcps .WaitForCondition (performanceMCP , machineconfigv1 .MachineConfigPoolUpdated , corev1 .ConditionTrue )
117- })
57+ // It("[test_id:30894] Tuned status name tied to Performance Profile", func() {
58+ // profile, err := profiles.GetByNodeLabels(testutils.NodeSelectorLabels)
59+ // Expect(err).ToNot(HaveOccurred())
60+ // tunedList := &tunedv1.TunedList{}
61+ // tunedName, err := tunedutils.GetName(context.TODO(), testclient.ControlPlaneClient, profile.Name)
62+ // Expect(err).ToNot(HaveOccurred())
63+ // tunedNamespacedName := types.NamespacedName{
64+ // Name: tunedName,
65+ // Namespace: components.NamespaceNodeTuningOperator,
66+ // }
67+ // // on hypershift platform, we're getting the tuned object that was mirrored by NTO to the hosted cluster,
68+ // // hence we're using the DataPlaneClient here.
69+ // Eventually(func(g Gomega) {
70+ // g.Expect(testclient.DataPlaneClient.List(context.TODO(), tunedList, &client.ListOptions{
71+ // Namespace: tunedNamespacedName.Namespace,
72+ // })).To(Succeed())
73+ // Expect(tunedList.Items).To(MatchTunedName(tunedName))
74+ // }).WithTimeout(time.Minute).WithPolling(time.Second * 10).Should(Succeed())
75+ // Expect(*profile.Status.Tuned).ToNot(BeNil())
76+ // Expect(*profile.Status.Tuned).To(Equal(tunedNamespacedName.String()))
77+ // })
78+ //
79+ // It("[test_id:33791] Should include the generated runtime class name", func() {
80+ // profile, err := profiles.GetByNodeLabels(testutils.NodeSelectorLabels)
81+ // Expect(err).ToNot(HaveOccurred())
82+ //
83+ // key := types.NamespacedName{
84+ // Name: components.GetComponentName(profile.Name, components.ComponentNamePrefix),
85+ // Namespace: metav1.NamespaceAll,
86+ // }
87+ // runtimeClass := &nodev1.RuntimeClass{}
88+ // err = testclient.GetWithRetry(context.TODO(), testclient.DataPlaneClient, key, runtimeClass)
89+ // Expect(err).ToNot(HaveOccurred(), "cannot find the RuntimeClass object "+key.String())
90+ //
91+ // Expect(profile.Status.RuntimeClass).NotTo(BeNil())
92+ // Expect(*profile.Status.RuntimeClass).To(Equal(runtimeClass.Name))
93+ // })
94+ //
95+ // It("[test_id:29673] Machine config pools status tied to Performance Profile", Label(string(label.OpenShift)), func() {
96+ // // Creating bad MC that leads to degraded state
97+ // By("Creating bad MachineConfig")
98+ // badMC := createBadMachineConfig("bad-mc")
99+ // err = testclient.ControlPlaneClient.Create(context.TODO(), badMC)
100+ // Expect(err).ToNot(HaveOccurred())
101+ //
102+ // By("Wait for MCP condition to be Degraded")
103+ // profile, err := profiles.GetByNodeLabels(testutils.NodeSelectorLabels)
104+ // Expect(err).ToNot(HaveOccurred())
105+ // performanceMCP, err := mcps.GetByProfile(profile)
106+ // Expect(err).ToNot(HaveOccurred())
107+ // mcps.WaitForCondition(performanceMCP, machineconfigv1.MachineConfigPoolDegraded, corev1.ConditionTrue)
108+ // mcpConditionReason := mcps.GetConditionReason(performanceMCP, machineconfigv1.MachineConfigPoolDegraded)
109+ // profileConditionMessage := profiles.GetConditionMessage(testutils.NodeSelectorLabels, v1.ConditionDegraded)
110+ // // Verify the status reason of performance profile
111+ // Expect(profileConditionMessage).To(ContainSubstring(mcpConditionReason))
112+ //
113+ // By("Deleting bad MachineConfig and waiting when Degraded state is removed")
114+ // err = testclient.ControlPlaneClient.Delete(context.TODO(), badMC)
115+ // Expect(err).ToNot(HaveOccurred())
116+ //
117+ // mcps.WaitForCondition(performanceMCP, machineconfigv1.MachineConfigPoolUpdated, corev1.ConditionTrue)
118+ // })
118119
119120 It ("[test_id:40402] Tuned profile status tied to Performance Profile" , func () {
120121 // During this test we're creating additional synthetic tuned CR by invoking the createrBadTuned function.
@@ -127,16 +128,32 @@ var _ = Describe("Status testing of performance profile", Ordered, func() {
127128 // on openshift this is the namespace where NTO/PAO creates tuned objects
128129 ns := components .NamespaceNodeTuningOperator
129130
131+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "tuned" , "-n" , ns )
132+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "profile" , "-n" , ns )
133+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "performanceprofile/performance" , "-n" , ns , "-o" , "yaml" )
134+
130135 // Creating a bad Tuned object that leads to degraded state
131136 cleanupFunc := createBadTuned (tunedName , ns )
132137 defer func () {
133138 By ("Deleting bad Tuned and waiting when Degraded state is removed" )
134139 cleanupFunc ()
140+
141+ By ("3) Sleeping 30" )
142+ time .Sleep (30 * time .Second )
143+
144+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "tuned" , "-n" , ns )
145+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "profile" , "-n" , ns )
146+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "performanceprofile/performance" , "-n" , ns , "-o" , "yaml" )
147+
135148 profiles .WaitForCondition (testutils .NodeSelectorLabels , v1 .ConditionAvailable , corev1 .ConditionTrue )
136149 }()
137150
138151 By ("Waiting for performance profile condition to be Degraded" )
139152 profiles .WaitForCondition (testutils .NodeSelectorLabels , v1 .ConditionDegraded , corev1 .ConditionTrue )
153+
154+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "tuned" , "-n" , ns )
155+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "profile" , "-n" , ns )
156+ _ , _ , err = util .ExecAndLogCommand ("oc" , "get" , "performanceprofile/performance" , "-n" , ns , "-o" , "yaml" )
140157 })
141158 })
142159})
0 commit comments