Skip to content

Commit 261f317

Browse files
committed
Adding unit tests for the extend recommended alerts
1 parent 17103c5 commit 261f317

9 files changed

Lines changed: 381 additions & 0 deletions
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"status": "success",
3+
"data": {
4+
"alerts": [
5+
{
6+
"labels": {
7+
"alertname": "VirtHandlerDaemonSetRolloutFailing",
8+
"channel": "stable-4.22",
9+
"namespace": "openshift-cluster-version",
10+
"severity": "warning",
11+
"upstream": "https://amd64.origin.releases.ci.openshift.org/graph",
12+
"openShiftUpdatePrecheck": "true"
13+
},
14+
"annotations": {
15+
"description": "For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/.",
16+
"summary": "Your upstream update recommendation service recommends you update your cluster."
17+
},
18+
"state": "firing",
19+
"activeAt": "2025-09-09T16:59:17.077287821Z",
20+
"value": "2e+00",
21+
"partialResponseStrategy": "WARN"
22+
},
23+
{
24+
"labels": {
25+
"alertname": "VMCannotBeEvicted",
26+
"container": "insights-operator",
27+
"description": "GSS does not provide enterprise-level support for an OKD cluster",
28+
"endpoint": "https",
29+
"info_link": "https://console.redhat.com/openshift/insights/advisor/clusters/7a18f603-2a0c-4794-af53-85bdae9b8ea9?first=ccx_rules_ocp.external.rules.okd_cluster_unsupported%7COKD_CLUSTER_UNSUPPORTED",
30+
"instance": "10.130.0.31:8443",
31+
"job": "metrics",
32+
"namespace": "openshift-insights",
33+
"pod": "insights-operator-b8b5f97fc-kl8rr",
34+
"service": "metrics",
35+
"severity": "warning",
36+
"total_risk": "Moderate",
37+
"openShiftUpdatePrecheck": "false"
38+
},
39+
"annotations": {
40+
"description": "Insights recommendation \"GSS does not provide enterprise-level support for an OKD cluster\" with total risk \"Moderate\" was detected on the cluster. More information is available at https://console.redhat.com/openshift/insights/advisor/clusters/7a18f603-2a0c-4794-af53-85bdae9b8ea9?first=ccx_rules_ocp.external.rules.okd_cluster_unsupported%7COKD_CLUSTER_UNSUPPORTED.",
41+
"summary": "An Insights recommendation is active for this cluster."
42+
},
43+
"state": "firing",
44+
"activeAt": "2025-09-09T16:52:41.445352906Z",
45+
"value": "1e+00",
46+
"partialResponseStrategy": "WARN"
47+
},
48+
{
49+
"labels": {
50+
"alertname": "TestAlert",
51+
"name": "ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2",
52+
"namespace": "openshift-machine-api",
53+
"severity": "warning",
54+
"openShiftUpdatePrecheck": "true"
55+
},
56+
"annotations": {
57+
"description": "The machine has been without a Running or Deleting phase for more than 60 minutes.\nThe machine may not have been provisioned properly from the infrastructure provider, or\nit might have issues with CertificateSigningRequests being approved.\n",
58+
"summary": "machine ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2 is in phase: "
59+
},
60+
"state": "firing",
61+
"activeAt": "2025-09-09T16:49:56.763336056Z",
62+
"value": "1.757435418e+09",
63+
"partialResponseStrategy": "WARN"
64+
}
65+
]
66+
}
67+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
apiVersion: config.openshift.io/v1
2+
kind: ClusterVersion
3+
metadata:
4+
creationTimestamp: "2025-09-09T16:25:09Z"
5+
generation: 3
6+
name: version
7+
resourceVersion: "31455"
8+
uid: 31502537-d38e-4652-a5a6-18b0d767b354
9+
spec:
10+
channel: stable-4.22
11+
clusterID: 7a18f603-2a0c-4794-af53-85bdae9b8ea9
12+
upstream: https://amd64.origin.releases.ci.openshift.org/graph
13+
status:
14+
availableUpdates:
15+
- image: registry.ci.openshift.org/ocp/release@sha256:64db99b4f820a919ba98e077f181f6b385a6883b88984a5acbebae0aef319561
16+
version: 4.22.0-0.nightly-2026-02-26-092444
17+
capabilities:
18+
enabledCapabilities:
19+
- Build
20+
- CSISnapshot
21+
- CloudControllerManager
22+
- CloudCredential
23+
- Console
24+
- DeploymentConfig
25+
- ImageRegistry
26+
- Ingress
27+
- Insights
28+
- MachineAPI
29+
- NodeTuning
30+
- OperatorLifecycleManager
31+
- OperatorLifecycleManagerV1
32+
- Storage
33+
- baremetal
34+
- marketplace
35+
- openshift-samples
36+
knownCapabilities:
37+
- Build
38+
- CSISnapshot
39+
- CloudControllerManager
40+
- CloudCredential
41+
- Console
42+
- DeploymentConfig
43+
- ImageRegistry
44+
- Ingress
45+
- Insights
46+
- MachineAPI
47+
- NodeTuning
48+
- OperatorLifecycleManager
49+
- OperatorLifecycleManagerV1
50+
- Storage
51+
- baremetal
52+
- marketplace
53+
- openshift-samples
54+
conditions:
55+
- lastTransitionTime: "2025-09-09T16:58:30Z"
56+
status: "True"
57+
type: RetrievedUpdates
58+
- lastTransitionTime: "2025-09-09T16:25:36Z"
59+
message: Capabilities match configured spec
60+
reason: AsExpected
61+
status: "False"
62+
type: ImplicitlyEnabledCapabilities
63+
- lastTransitionTime: "2025-09-09T16:25:36Z"
64+
message: Payload loaded version="4.22.0-ec.3" image="quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5"
65+
architecture="amd64"
66+
reason: PayloadLoaded
67+
status: "True"
68+
type: ReleaseAccepted
69+
- lastTransitionTime: "2025-09-09T16:55:08Z"
70+
message: Done applying 4.22.0-ec.3
71+
status: "True"
72+
type: Available
73+
- lastTransitionTime: "2025-09-09T16:55:08Z"
74+
status: "False"
75+
type: Failing
76+
- lastTransitionTime: "2025-09-09T16:55:08Z"
77+
message: Cluster version is 4.22.0-ec.3
78+
status: "False"
79+
type: Progressing
80+
desired:
81+
image: quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5
82+
version: 4.22.0-ec.3
83+
history:
84+
- completionTime: "2025-09-09T16:55:08Z"
85+
image: quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5
86+
startedTime: "2025-09-09T16:25:36Z"
87+
state: Completed
88+
verified: false
89+
version: 4.22.0-ec.3
90+
observedGeneration: 1
91+
versionHash: XI4117989oE=
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
The following conditions found no cause for concern in updating this cluster to later releases: recommended/CriticalAlerts (AsExpected), recommended/NodeAlerts (AsExpected), recommended/PodDisruptionBudgetAlerts (AsExpected), recommended/PodImagePullAlerts (AsExpected)
2+
3+
The following conditions found cause for concern in updating this cluster to later releases: recommended/UpdatePrecheckAlerts/TestAlert/2, recommended/UpdatePrecheckAlerts/VirtHandlerDaemonSetRolloutFailing/0, recommended/VirtAlerts/VMCannotBeEvicted/1
4+
5+
recommended/UpdatePrecheckAlerts/VirtHandlerDaemonSetRolloutFailing/0=False:
6+
7+
Reason: Alert:firing
8+
Message: warning alert VirtHandlerDaemonSetRolloutFailing firing, suggesting issues worth investigating before updating the cluster. Your upstream update recommendation service recommends you update your cluster. The alert description is: For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/. <alert does not have a runbook_url annotation>
9+
10+
recommended/VirtAlerts/VMCannotBeEvicted/1=False:
11+
12+
Reason: Alert:firing
13+
Message: warning alert VMCannotBeEvicted firing, which may slow workload redistribution during rolling node updates. An Insights recommendation is active for this cluster. The alert description is: Insights recommendation "GSS does not provide enterprise-level support for an OKD cluster" with total risk "Moderate" was detected on the cluster. More information is available at https://console.redhat.com/openshift/insights/advisor/clusters/7a18f603-2a0c-4794-af53-85bdae9b8ea9?first=ccx_rules_ocp.external.rules.okd_cluster_unsupported%7COKD_CLUSTER_UNSUPPORTED. <alert does not have a runbook_url annotation>
14+
15+
recommended/UpdatePrecheckAlerts/TestAlert/2=False:
16+
17+
Reason: Alert:firing
18+
Message: warning alert TestAlert firing, suggesting issues worth investigating before updating the cluster. machine ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2 is in phase: . The alert description is: The machine has been without a Running or Deleting phase for more than 60 minutes.
19+
The machine may not have been provisioned properly from the infrastructure provider, or
20+
it might have issues with CertificateSigningRequests being approved.
21+
<alert does not have a runbook_url annotation>
22+
23+
Upstream update service: https://amd64.origin.releases.ci.openshift.org/graph
24+
Channel: stable-4.22
25+
26+
Updates to 4.22:
27+
VERSION ISSUES
28+
4.22.0-0.nightly-2026-02-26-092444 no known issues relevant to this cluster
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
The following conditions found no cause for concern in updating this cluster to later releases: recommended/CriticalAlerts (AsExpected), recommended/NodeAlerts (AsExpected), recommended/PodDisruptionBudgetAlerts (AsExpected), recommended/PodImagePullAlerts (AsExpected)
2+
3+
The following conditions found cause for concern in updating this cluster to later releases: recommended/UpdatePrecheckAlerts/TestAlert/2, recommended/UpdatePrecheckAlerts/VirtHandlerDaemonSetRolloutFailing/0, recommended/VirtAlerts/VMCannotBeEvicted/1
4+
5+
recommended/UpdatePrecheckAlerts/VirtHandlerDaemonSetRolloutFailing/0=False:
6+
7+
Reason: Alert:firing
8+
Message: warning alert VirtHandlerDaemonSetRolloutFailing firing, suggesting issues worth investigating before updating the cluster. Your upstream update recommendation service recommends you update your cluster. The alert description is: For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/. <alert does not have a runbook_url annotation>
9+
10+
recommended/VirtAlerts/VMCannotBeEvicted/1=False:
11+
12+
Reason: Alert:firing
13+
Message: warning alert VMCannotBeEvicted firing, which may slow workload redistribution during rolling node updates. An Insights recommendation is active for this cluster. The alert description is: Insights recommendation "GSS does not provide enterprise-level support for an OKD cluster" with total risk "Moderate" was detected on the cluster. More information is available at https://console.redhat.com/openshift/insights/advisor/clusters/7a18f603-2a0c-4794-af53-85bdae9b8ea9?first=ccx_rules_ocp.external.rules.okd_cluster_unsupported%7COKD_CLUSTER_UNSUPPORTED. <alert does not have a runbook_url annotation>
14+
15+
recommended/UpdatePrecheckAlerts/TestAlert/2=False:
16+
17+
Reason: Alert:firing
18+
Message: warning alert TestAlert firing, suggesting issues worth investigating before updating the cluster. machine ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2 is in phase: . The alert description is: The machine has been without a Running or Deleting phase for more than 60 minutes.
19+
The machine may not have been provisioned properly from the infrastructure provider, or
20+
it might have issues with CertificateSigningRequests being approved.
21+
<alert does not have a runbook_url annotation>
22+
23+
Upstream update service: https://amd64.origin.releases.ci.openshift.org/graph
24+
Channel: stable-4.22
25+
26+
Updates to 4.22:
27+
VERSION ISSUES
28+
4.22.0-0.nightly-2026-02-26-092444 no known issues relevant to this cluster
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"status": "success",
3+
"data": {
4+
"alerts": [
5+
{
6+
"labels": {
7+
"alertname": "VirtHandlerDaemonSetRolloutFailing",
8+
"channel": "stable-4.22",
9+
"namespace": "openshift-cluster-version",
10+
"severity": "critical",
11+
"upstream": "https://amd64.origin.releases.ci.openshift.org/graph",
12+
"openShiftUpdatePrecheck": "true"
13+
},
14+
"annotations": {
15+
"description": "For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/.",
16+
"summary": "Your upstream update recommendation service recommends you update your cluster."
17+
},
18+
"state": "firing",
19+
"activeAt": "2025-09-09T16:59:17.077287821Z",
20+
"value": "2e+00",
21+
"partialResponseStrategy": "WARN"
22+
},
23+
{
24+
"labels": {
25+
"alertname": "VMCannotBeEvicted",
26+
"name": "ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2",
27+
"namespace": "openshift-machine-api",
28+
"severity": "critical",
29+
"openShiftUpdatePrecheck": "true"
30+
},
31+
"annotations": {
32+
"description": "The machine has been without a Running or Deleting phase for more than 60 minutes.\nThe machine may not have been provisioned properly from the infrastructure provider, or\nit might have issues with CertificateSigningRequests being approved.\n",
33+
"summary": "machine ci-ln-plnvytb-76ef8-42h8v-worker-us-east-1a-84pg2 is in phase: "
34+
},
35+
"state": "pending",
36+
"activeAt": "2025-09-09T16:49:56.763336056Z",
37+
"value": "1.757435418e+09",
38+
"partialResponseStrategy": "WARN"
39+
}
40+
]
41+
}
42+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
apiVersion: config.openshift.io/v1
2+
kind: ClusterVersion
3+
metadata:
4+
creationTimestamp: "2025-09-09T16:25:09Z"
5+
generation: 3
6+
name: version
7+
resourceVersion: "31455"
8+
uid: 31502537-d38e-4652-a5a6-18b0d767b354
9+
spec:
10+
channel: stable-4.22
11+
clusterID: 7a18f603-2a0c-4794-af53-85bdae9b8ea9
12+
upstream: https://amd64.origin.releases.ci.openshift.org/graph
13+
status:
14+
availableUpdates:
15+
- image: registry.ci.openshift.org/ocp/release@sha256:64db99b4f820a919ba98e077f181f6b385a6883b88984a5acbebae0aef319561
16+
version: 4.22.0-0.nightly-2026-02-26-092444
17+
capabilities:
18+
enabledCapabilities:
19+
- Build
20+
- CSISnapshot
21+
- CloudControllerManager
22+
- CloudCredential
23+
- Console
24+
- DeploymentConfig
25+
- ImageRegistry
26+
- Ingress
27+
- Insights
28+
- MachineAPI
29+
- NodeTuning
30+
- OperatorLifecycleManager
31+
- OperatorLifecycleManagerV1
32+
- Storage
33+
- baremetal
34+
- marketplace
35+
- openshift-samples
36+
knownCapabilities:
37+
- Build
38+
- CSISnapshot
39+
- CloudControllerManager
40+
- CloudCredential
41+
- Console
42+
- DeploymentConfig
43+
- ImageRegistry
44+
- Ingress
45+
- Insights
46+
- MachineAPI
47+
- NodeTuning
48+
- OperatorLifecycleManager
49+
- OperatorLifecycleManagerV1
50+
- Storage
51+
- baremetal
52+
- marketplace
53+
- openshift-samples
54+
conditions:
55+
- lastTransitionTime: "2025-09-09T16:58:30Z"
56+
status: "True"
57+
type: RetrievedUpdates
58+
- lastTransitionTime: "2025-09-09T16:25:36Z"
59+
message: Capabilities match configured spec
60+
reason: AsExpected
61+
status: "False"
62+
type: ImplicitlyEnabledCapabilities
63+
- lastTransitionTime: "2025-09-09T16:25:36Z"
64+
message: Payload loaded version="4.22.0-ec.3" image="quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5"
65+
architecture="amd64"
66+
reason: PayloadLoaded
67+
status: "True"
68+
type: ReleaseAccepted
69+
- lastTransitionTime: "2025-09-09T16:55:08Z"
70+
message: Done applying 4.22.0-ec.3
71+
status: "True"
72+
type: Available
73+
- lastTransitionTime: "2025-09-09T16:55:08Z"
74+
status: "False"
75+
type: Failing
76+
- lastTransitionTime: "2025-09-09T16:55:08Z"
77+
message: Cluster version is 4.22.0-ec.3
78+
status: "False"
79+
type: Progressing
80+
desired:
81+
image: quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5
82+
version: 4.22.0-ec.3
83+
history:
84+
- completionTime: "2025-09-09T16:55:08Z"
85+
image: quay.io/openshift-release-dev/ocp-release@sha256:58b98da1492b3f4af6129c4684b8e8cde4f2dc197e4b483bb6025971d59f92a5
86+
startedTime: "2025-09-09T16:25:36Z"
87+
state: Completed
88+
verified: false
89+
version: 4.22.0-ec.3
90+
observedGeneration: 1
91+
versionHash: XI4117989oE=
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The following conditions found no cause for concern in updating this cluster to later releases: recommended/NodeAlerts (AsExpected), recommended/PodDisruptionBudgetAlerts (AsExpected), recommended/PodImagePullAlerts (AsExpected), recommended/UpdatePrecheckAlerts (AsExpected)
2+
3+
The following conditions found cause for concern in updating this cluster to later releases: recommended/CriticalAlerts/VirtHandlerDaemonSetRolloutFailing/0
4+
5+
recommended/CriticalAlerts/VirtHandlerDaemonSetRolloutFailing/0=False:
6+
7+
Reason: Alert:firing
8+
Message: critical alert VirtHandlerDaemonSetRolloutFailing firing, suggesting significant cluster issues worth investigating. Your upstream update recommendation service recommends you update your cluster. The alert description is: For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/. <alert does not have a runbook_url annotation>
9+
10+
Upstream update service: https://amd64.origin.releases.ci.openshift.org/graph
11+
Channel: stable-4.22
12+
13+
Updates to 4.22:
14+
VERSION ISSUES
15+
4.22.0-0.nightly-2026-02-26-092444 no known issues relevant to this cluster
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The following conditions found no cause for concern in updating this cluster to later releases: recommended/NodeAlerts (AsExpected), recommended/PodDisruptionBudgetAlerts (AsExpected), recommended/PodImagePullAlerts (AsExpected), recommended/UpdatePrecheckAlerts (AsExpected)
2+
3+
The following conditions found cause for concern in updating this cluster to later releases: recommended/CriticalAlerts/VirtHandlerDaemonSetRolloutFailing/0
4+
5+
recommended/CriticalAlerts/VirtHandlerDaemonSetRolloutFailing/0=False:
6+
7+
Reason: Alert:firing
8+
Message: critical alert VirtHandlerDaemonSetRolloutFailing firing, suggesting significant cluster issues worth investigating. Your upstream update recommendation service recommends you update your cluster. The alert description is: For more information refer to 'oc adm upgrade' or https://console-openshift-console.apps.ci-ln-plnvytb-76ef8.aws-2.ci.openshift.org/settings/cluster/. <alert does not have a runbook_url annotation>
9+
10+
Upstream update service: https://amd64.origin.releases.ci.openshift.org/graph
11+
Channel: stable-4.22
12+
13+
Updates to 4.22:
14+
VERSION ISSUES
15+
4.22.0-0.nightly-2026-02-26-092444 no known issues relevant to this cluster

pkg/cli/admin/upgrade/recommend/examples_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ func TestExamples(t *testing.T) {
8080
var version string
8181
if version = variant.versions[cv]; version != "" {
8282
variant.outputSuffix = fmt.Sprintf(variant.outputSuffixPattern, version)
83+
} else {
84+
if variant.name == "specific version" {
85+
continue
86+
}
8387
}
8488
t.Run(fmt.Sprintf("%s-%s", cv, variant.name), func(t *testing.T) {
8589
t.Parallel()

0 commit comments

Comments
 (0)