-
Notifications
You must be signed in to change notification settings - Fork 4.8k
(WIP) OCPBUGS-57177 #31549
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
base: main
Are you sure you want to change the base?
(WIP) OCPBUGS-57177 #31549
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,7 @@ var _ = g.Describe("[Suite:openshift/machine-config-operator/disruptive][sig-mco | |
| ) | ||
|
|
||
| g.BeforeEach(func(ctx context.Context) { | ||
| //skip these tests on hypershift platforms | ||
| // skip these tests on hypershift platforms | ||
| if ok, _ := exutil.IsHypershift(ctx, oc.AdminConfigClient()); ok { | ||
| g.Skip("PinnedImages is not supported on hypershift. Skipping tests.") | ||
| } | ||
|
|
@@ -464,10 +464,10 @@ func detectXCondition(oc *exutil.CLI, node corev1.Node, mcn *mcfgv1.MachineConfi | |
| // 3. Get the nodes part of the MCP from step 2 | ||
| // 4. Loop through the nodes to see if the desired conditions are met | ||
| // - If the PIS is expected to be invalid, it checks that the degrade condition in the | ||
| // corresponding MCN becomes "true" | ||
| // corresponding MCN becomes "true" and that the associated MCP degrades | ||
| // - If the PIS is expected to be valid, it checks that the desired images are pinned on the | ||
| // corresponding nodes and that the MCN conditions properly report the success | ||
| func waitForPISStatusX(ctx context.Context, oc *exutil.CLI, kubeClient *kubernetes.Clientset, clientSet *mcClient.Clientset, pisName string, success bool, isMetalDisconnected bool) error { | ||
| func waitForPISStatusX(ctx context.Context, oc *exutil.CLI, kubeClient *kubernetes.Clientset, clientSet *mcClient.Clientset, pisName string, success, isMetalDisconnected bool) error { | ||
| return wait.PollUntilContextCancel(ctx, time.Second, true, func(ctx context.Context) (done bool, err error) { | ||
| // Wait for PIS object to get created | ||
| appliedPIS, err := clientSet.MachineconfigurationV1().PinnedImageSets().Get(context.TODO(), pisName, metav1.GetOptions{}) | ||
|
|
@@ -493,11 +493,22 @@ func waitForPISStatusX(ctx context.Context, oc *exutil.CLI, kubeClient *kubernet | |
| // Loop through nodes to see if the conditions required to consider the pis apply "done" are met | ||
| doneNodes := 0 | ||
| for _, node := range nodes.Items { | ||
| if !success { // handle case when we are expecting the PIS application to fail, so the PIS degraded condition should become true | ||
| if !success { // handle case when we are expecting the PIS application to fail | ||
| // The `PinnedImageSetsDegraded` MachineConfigNode condition should be `True` | ||
| framework.Logf("Waiting for PinnedImageSetsDegraded=True") | ||
| conditionMet, err := WaitForMCNConditionStatus(clientSet, node.Name, mcfgv1.MachineConfigNodePinnedImageSetsDegraded, metav1.ConditionTrue, 2*time.Minute, 5*time.Second) | ||
| o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("Error occured while waiting for PinnedImageSetsDegraded=True: %v", err)) | ||
| o.Expect(conditionMet).To(o.BeTrue(), "Error, could not detect PinnedImageSetsDegraded=True.") | ||
|
|
||
| // The associated MachineConfigPool should degrade | ||
| framework.Logf("Waiting for MCP `%v` to be Degraded=True", pool.Name) | ||
| err = WaitForMCPConditionStatus(oc, pool.Name, mcfgv1.MachineConfigPoolDegraded, corev1.ConditionTrue, 30*time.Second, 5*time.Second) | ||
| o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("Error occured while waiting for MachineConfigPoolDegraded=True: %v", err)) | ||
|
|
||
| // The associated MachineConfigPool should not be in an "Updating" state | ||
| framework.Logf("Ensuring MCP `%v` is in Updating=False", pool.Name) | ||
| isExpected := IsMachineConfigPoolConditionExpected(pool.Status.Conditions, mcfgv1.MachineConfigPoolUpdating, corev1.ConditionFalse) | ||
| o.Expect(isExpected).To(o.BeTrue(), fmt.Sprintf("MCP `%v` does not have condition Updating=False", pool.Name)) | ||
|
Comment on lines
+508
to
+511
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable conventions and learnings ---'
head -5 /tmp/coderabbit-repo-knowledge/openshift-origin-99a43837/*/*.md 2>/dev/null || true
printf '%s\n' '--- target excerpt ---'
sed -n '450,520p' test/extended/machine_config/pinnedimages.go
printf '%s\n' '--- bound symbols and callers ---'
rg -n -U 'func WaitForMCPConditionStatus|WaitForMCPConditionStatus\(' --glob '*.go' .
rg -n 'IsMachineConfigPoolConditionExpected|pool[[:space:]]*:?=[[:space:]]*.*MachineConfigPool|Get.*MachineConfigPool|MachineConfigPool.*Get' test/extended/machine_config/pinnedimages.goRepository: openshift/origin Length of output: 23055 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- WaitForMCPConditionStatus implementation ---'
sed -n '530,565p' test/extended/machine_config/helpers.go
printf '%s\n' '--- condition helper implementation ---'
rg -n -U 'func IsMachineConfigPoolConditionExpected|IsMachineConfigPoolConditionExpected\(' test/extended/machine_config --glob '*.go'
sed -n '1,80p' test/extended/machine_config/pinnedimages.goRepository: openshift/origin Length of output: 6799 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- complete wait helper ---'
sed -n '545,585p' test/extended/machine_config/helpers.go
printf '%s\n' '--- condition predicate ---'
sed -n '185,205p' test/extended/machine_config/helpers.goRepository: openshift/origin Length of output: 3358 Poll
🤖 Prompt for AI Agents |
||
| } else { // handle cases where we are expecting the PIS application to succeed | ||
| mcn, err := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(ctx, node.Name, metav1.GetOptions{}) | ||
| if err != nil { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.