-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add E2E integration test for lightspeed-agentic-alerts-adapter #83711
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?
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # DO NOT EDIT; this file is auto-generated using https://github.com/openshift/ci-tools. | ||
| # Fetched from https://github.com/openshift/lightspeed-agentic-alerts-adapter root OWNERS | ||
| # If the repo had OWNERS_ALIASES then the aliases were expanded | ||
| # Logins who are not members of 'openshift' organization were filtered out | ||
| # See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md | ||
|
|
||
| approvers: | ||
| - falox | ||
| - rioloc | ||
| - tremes | ||
| options: {} | ||
| reviewers: | ||
| - falox | ||
| - rioloc | ||
| - tremes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| STEP_SECONDS=0 | ||
|
|
||
| function log { | ||
| echo "[$(date '+%Y-%m-%d %H:%M:%S')] [+$((SECONDS / 60))m$((SECONDS % 60))s] $*" | ||
| } | ||
|
|
||
| function start_step { | ||
| STEP_SECONDS=$SECONDS | ||
| log "=== START: $* ===" | ||
| } | ||
|
|
||
| function end_step { | ||
| local step_duration=$((SECONDS - STEP_SECONDS)) | ||
| log "=== END: $* (took $((step_duration / 60))m$((step_duration % 60))s) ===" | ||
| } | ||
|
|
||
| function collect_artifacts { | ||
| set +e | ||
| log "=== Collecting debug artifacts ===" | ||
|
|
||
| # Adapter resources | ||
| oc describe pods -n "${NAMESPACE}" > "${ARTIFACT_DIR}/adapter-pod-describe.txt" 2>&1 || true | ||
| oc logs "deployment/${DEPLOYMENT_NAME}" -n "${NAMESPACE}" --all-containers > "${ARTIFACT_DIR}/adapter-logs.txt" 2>&1 || true | ||
| oc logs "deployment/${DEPLOYMENT_NAME}" -n "${NAMESPACE}" --all-containers --previous > "${ARTIFACT_DIR}/adapter-logs-previous.txt" 2>&1 || true | ||
| oc get events -n "${NAMESPACE}" --sort-by='.lastTimestamp' > "${ARTIFACT_DIR}/adapter-events.txt" 2>&1 || true | ||
| oc get all -n "${NAMESPACE}" -o yaml > "${ARTIFACT_DIR}/adapter-resources.yaml" 2>&1 || true | ||
|
|
||
| # AgenticRun CRs created during test | ||
| oc get agenticruns -n "${NAMESPACE}" -o yaml > "${ARTIFACT_DIR}/agenticruns.yaml" 2>&1 || true | ||
|
|
||
| # Operator resources (if present) | ||
| if [[ -n "${OPERATOR_NAMESPACE:-}" ]]; then | ||
| oc describe pods -n "${OPERATOR_NAMESPACE}" > "${ARTIFACT_DIR}/operator-pod-describe.txt" 2>&1 || true | ||
| oc logs -n "${OPERATOR_NAMESPACE}" -l app=lightspeed-agentic-operator --all-containers > "${ARTIFACT_DIR}/operator-logs.txt" 2>&1 || true | ||
| fi | ||
|
Comment on lines
+36
to
+39
Contributor
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 Use one fallback for When Proposed change+OPERATOR_NAMESPACE="${OPERATOR_NAMESPACE:-openshift-lightspeed}"
+
...
- if [[ -n "${OPERATOR_NAMESPACE:-}" ]]; then
+ if [[ -n "${OPERATOR_NAMESPACE}" ]]; then
...
- log "OPERATOR_NAMESPACE: ${OPERATOR_NAMESPACE:-openshift-lightspeed}"
+ log "OPERATOR_NAMESPACE: ${OPERATOR_NAMESPACE}"Also applies to: 51-51 🤖 Prompt for AI Agents |
||
|
|
||
| log "=== Artifacts collected in ${ARTIFACT_DIR} ===" | ||
| log "=== Total script duration: $((SECONDS / 60))m$((SECONDS % 60))s (${SECONDS}s) ===" | ||
| } | ||
|
|
||
| trap collect_artifacts EXIT | ||
|
Contributor
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. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Run cleanup when deployment or tests fail. If Run cleanup from the EXIT handler. Preserve the original failure status. Collect artifacts before cleanup. Proposed fix-trap collect_artifacts EXIT
+function on_exit {
+ local exit_code=$?
+ trap - EXIT
+ collect_artifacts
+
+ if ! make undeploy-e2e; then
+ log "ERROR: make undeploy-e2e failed"
+ if [[ "${exit_code}" -eq 0 ]]; then
+ exit_code=1
+ fi
+ fi
+
+ exit "${exit_code}"
+}
+
+trap on_exit EXIT
@@
-start_step "Cleanup with make undeploy-e2e"
-make undeploy-e2e
-end_step "Cleanup with make undeploy-e2e"Also applies to: 71-83 🤖 Prompt for AI Agents |
||
|
|
||
| log "=== Lightspeed Agentic Alerts Adapter E2E ===" | ||
| log "IMAGE: ${IMAGE}" | ||
| log "NAMESPACE: ${NAMESPACE}" | ||
| log "DEPLOYMENT_NAME: ${DEPLOYMENT_NAME}" | ||
| log "OPERATOR_NAMESPACE: ${OPERATOR_NAMESPACE:-openshift-lightspeed}" | ||
|
|
||
| start_step "Installing prerequisites" | ||
| # Ensure oc and yq are available | ||
| if ! command -v oc &>/dev/null; then | ||
| log "ERROR: oc command not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! command -v yq &>/dev/null; then | ||
| log "Installing yq..." | ||
| YQ_VERSION="v4.40.5" | ||
| YQ_BINARY="yq_linux_amd64" | ||
|
|
||
| # Create private directory for binary | ||
| YQ_DIR=$(mktemp -d) | ||
| chmod 700 "${YQ_DIR}" | ||
|
|
||
| # Download binary and checksums | ||
| curl --fail --show-error --location \ | ||
| "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" \ | ||
| -o "${YQ_DIR}/yq" | ||
| curl --fail --show-error --location \ | ||
| "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/checksums" \ | ||
| -o "${YQ_DIR}/checksums" | ||
|
|
||
| # Verify checksum | ||
| (cd "${YQ_DIR}" && grep "${YQ_BINARY}" checksums | sha256sum --check --status) || { | ||
| log "ERROR: yq checksum verification failed" | ||
| rm -rf "${YQ_DIR}" | ||
| exit 1 | ||
| } | ||
|
|
||
| chmod +x "${YQ_DIR}/yq" | ||
| export PATH="${YQ_DIR}:${PATH}" | ||
| log "yq installed at ${YQ_DIR}/yq" | ||
| fi | ||
| end_step "Installing prerequisites" | ||
|
|
||
| start_step "Deploy adapter with make deploy-e2e" | ||
| # The deploy-e2e.sh script expects IMAGE env var and uses the defaults we set | ||
| make deploy-e2e | ||
| end_step "Deploy adapter with make deploy-e2e" | ||
|
|
||
| start_step "Run E2E test suite" | ||
| # Run the Ginkgo-based E2E test suite (30m timeout in Makefile) | ||
| make test-e2e | ||
| end_step "Run E2E test suite" | ||
|
|
||
| start_step "Cleanup with make undeploy-e2e" | ||
| make undeploy-e2e | ||
| end_step "Cleanup with make undeploy-e2e" | ||
|
|
||
| log "=== E2E test complete ===" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "path": "lightspeed-agentic-alerts-adapter/lightspeed-agentic-alerts-adapter-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "falox", | ||
| "rioloc", | ||
| "tremes" | ||
| ], | ||
| "reviewers": [ | ||
| "falox", | ||
| "rioloc", | ||
| "tremes" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ref: | ||
| as: lightspeed-agentic-alerts-adapter | ||
| from: src | ||
| cli: latest | ||
| commands: lightspeed-agentic-alerts-adapter-commands.sh | ||
| timeout: 2h0m0s | ||
| grace_period: 60s | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
| env: | ||
| - name: NAMESPACE | ||
| default: "openshift-lightspeed" | ||
| documentation: "Namespace where lightspeed-agentic-alerts-adapter is deployed." | ||
| - name: DEPLOYMENT_NAME | ||
| default: "lightspeed-agentic-alerts-adapter" | ||
| documentation: "Name of the deployment to wait for." | ||
| - name: OPERATOR_NAMESPACE | ||
| default: "openshift-lightspeed" | ||
| documentation: "Namespace where the lightspeed-agentic-operator is deployed." | ||
| dependencies: | ||
| - name: "lightspeed-agentic-alerts-adapter" | ||
| env: IMAGE | ||
| documentation: |- | ||
| The lightspeed-agentic-alerts-adapter step deploys lightspeed-agentic-alerts-adapter | ||
| from the built image to an OpenShift cluster using hack/deploy-e2e.sh and runs | ||
| the E2E test suite with Ginkgo. The deployment script automatically installs | ||
| the lightspeed-agentic-operator if needed for the AgenticRun CRD. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/release
Length of output: 50373
🏁 Script executed:
Repository: openshift/release
Length of output: 50375
🌐 Web query:
OpenShift ci-operator cluster_claim owner field cluster pool owner documentation💡 Result:
In OpenShift CI, the owner field within the cluster_claim stanza is a mandatory label used to identify and select a specific cluster pool from which to claim an ephemeral cluster [1][2][3]. When a CI job is configured to use a cluster_claim, the ci-operator uses the provided metadata—architecture, cloud, owner, product, and version—to match against the labels defined on available cluster pools [1][2]. The owner label acts as a filter to ensure the job claims a cluster from the correct pool [1]. Key points regarding the owner field: - Purpose: It identifies the team or entity responsible for the cluster pool (e.g., openshift-ci, dptp-demo, or hypershift) [1][4]. - Matching: The value specified in the ci-operator configuration must match a corresponding owner label on the target cluster pool [1][2]. - Usage Policy: Cluster pools owned by openshift-ci are maintained by the DPTP team and are generally available for tests within the openshift organization [1]. Pools with different owners are intended for specific use cases and should only be accessed with the knowledge and approval of their respective owners [1]. - Configuration Example: tests: - as: example-test cluster_claim: architecture: amd64 cloud: aws owner: openshift-ci product: ocp timeout: 1h0m0s version: "4.18" For teams setting up their own cluster pools, the owner label is defined in the pool manifest applied to the hosted-management cluster [1]. Currently, authorization to use specific pools is not strictly enforced programmatically, but reliance on the owner field is the standard mechanism for managing cluster pool access and organization [1].
Citations:
🏁 Script executed:
Repository: openshift/release
Length of output: 30912
🌐 Web query:
site:github.com/openshift/release "owner: osa" "cluster_claim"💡 Result:
In the context of the OpenShift CI/CD infrastructure (specifically the openshift/release repository), cluster_claim is a configuration parameter used within CI operator job definitions to request or 'claim' a pre-provisioned cluster from a cluster pool [1][2]. Instead of performing the time-consuming process of installing a new cluster for every test run, CI jobs can use cluster_claim to utilize an existing cluster that matches specific criteria, such as [2]: - architecture (e.g., amd64) - cloud provider (e.g., aws) - product (e.g., ocp) - version (e.g., 4.18) - owner (e.g., hypershift) - timeout (e.g., 2h0m0s) This mechanism is managed by components like the clusterclaims-controller [3] and relies on ClusterPool resources [4], which maintain a pool of ready-to-use clusters. When a job defines a cluster_claim, the CI infrastructure orchestrates the lease of a cluster from the specified pool for the duration of the test execution, significantly reducing CI turnaround times [1].
Citations:
🌐 Web query:
site:github.com/openshift/release "owner: obs" "lightspeed"💡 Result:
OBS Lightspeed refers to components within the Red Hat OpenShift ecosystem related to Red Hat OpenShift Lightspeed, an AI-powered assistant designed for OpenShift [1][2][3]. In the context of the openshift/release repository, which manages CI/CD configurations for OpenShift, OBS Lightspeed components appear as various software projects and services, including: 1. lightspeed-service: A service component maintained as part of the OpenShift ecosystem, with dedicated CI/CD configurations and periodic test variants [4][2]. 2. lightspeed-operator: An operator responsible for managing aspects of the Lightspeed functionality within an OpenShift cluster [1]. 3. lightspeed-agentic-operator and lightspeed-agentic-sandbox: Additional components involving agentic AI capabilities within the OpenShift framework [3]. These components are owned and maintained by the Red Hat OpenShift engineering teams, as indicated by the repository structures and OWNERS files within the openshift/release CI tooling [2][5][3]. The term OBS in this context is often associated with observability or general OpenShift build services, depending on the specific subdirectory or component being referenced [1][6][7].
Citations:
🏁 Script executed:
Repository: openshift/release
Length of output: 31896
Use the owner that matches the intended cluster pool.
cluster_claim.ownerfilters cluster-pool labels; it does not select a cloud account. Related Lightspeed configurations useobs, but the PR objective specifiesosa. Changeobstoosaif that objective is authoritative. ( )🤖 Prompt for AI Agents