Skip to content

MCO-1722: Handle check for Disconnnected Clusters for PIS Testing using curl #29870

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

Merged
merged 1 commit into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions test/extended/machine_config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func IsTwoNodeArbiter(oc *exutil.CLI) bool {

// `IsDisconnected` returns true if the cluster is a Disconnected cluster and false otherwise
func IsDisconnected(oc *exutil.CLI, nodeName string) bool {
networkStatus, _ := exutil.DebugNodeRetryWithOptionsAndChroot(oc, nodeName, "openshift-machine-config-operator", "systemctl", "is-active", "NetworkManager-wait-online.service")
if networkStatus == "active" {
networkStatus, _ := exutil.DebugNodeRetryWithOptionsAndChroot(oc, nodeName, "openshift-machine-config-operator", "sh", "-c", "curl -s --connect-timeout 5 http://fedoraproject.org/static/hotspot.txt &>/dev/null && echo \"Connected\" || echo \"Disconnected\"")
if networkStatus == "Connected" {
return false
}
return true
Expand Down
21 changes: 11 additions & 10 deletions test/extended/machine_config/pinnedimages.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ func SimplePISTest(oc *exutil.CLI, kubeClient *kubernetes.Clientset, clientSet *

func detectXCondition(oc *exutil.CLI, node corev1.Node, mcn *mcfgv1.MachineConfigNode, appliedPIS *mcfgv1.PinnedImageSet, detectingSuccess bool, isMetalDisconnected bool) (bool, bool, error) {
if detectingSuccess {
if isMetalDisconnected {
crictlStatus, err := exutil.DebugNodeRetryWithOptionsAndChroot(oc, node.Name, "openshift-machine-config-operator", "crictl", "inspecti", emptyImagePin)
if err != nil {
return false, false, fmt.Errorf("failed to execute `crictl inspecti %s` on node %s: %w", emptyImagePin, node.Name, err)
}
if !strings.Contains(crictlStatus, "imageSpec") {
return false, false, fmt.Errorf("Image %s not present on node %s: %w", emptyImagePin, node.Name, err)
}
return true, false, nil
}

for _, cond := range mcn.Status.Conditions {
if mcfgv1.StateProgress(cond.Type) == mcfgv1.MachineConfigNodePinnedImageSetsDegraded && cond.Status == "True" {
return false, true, fmt.Errorf("PIS degraded for MCN %s with reason: %s and message: %s", mcn.Name, cond.Reason, cond.Message)
Expand All @@ -373,16 +384,6 @@ func detectXCondition(oc *exutil.CLI, node corev1.Node, mcn *mcfgv1.MachineConfi
}
}
for _, img := range appliedPIS.Spec.PinnedImages {
if isMetalDisconnected {
crictlStatus, err := exutil.DebugNodeRetryWithOptionsAndChroot(oc, node.Name, "openshift-machine-config-operator", "crictl", "inspecti", emptyImagePin)
if err != nil {
return false, false, fmt.Errorf("failed to execute `crictl inspecti %s` on node %s: %w", img.Name, node.Name, err)
}
if !strings.Contains(crictlStatus, "imageSpec") {
return false, false, fmt.Errorf("Image %s not present on node %s: %w", img.Name, node.Name, err)
}
break
}
crictlStatus, err := exutil.DebugNodeRetryWithOptionsAndChroot(oc, node.Name, "openshift-machine-config-operator", "crictl", "inspecti", string(img.Name))
if err != nil {
return false, false, fmt.Errorf("failed to execute `crictl inspecti %s` on node %s: %w", img.Name, node.Name, err)
Expand Down