<!--
SPDX-FileCopyrightText: Red Hat

SPDX-License-Identifier: Apache-2.0
-->

<!-- This file is auto-generated by hack/generate-e2e-outline.sh -->
<!-- To regenerate: make e2e-outline -->

# E2E Test Overview

This document provides an overview of all end-to-end test cases.
It is generated from the test source code using Ginkgo's outline
feature, which parses test structure without executing tests.

## Contents

- [MNO Standard ClusterVersion Upgrade [mno-cv-upgrade]](#mno-standard-clusterversion-upgrade-mno-cv-upgrade)
  - [y-stream upgrade 4.19.3 to 4.20.5 with failure recovery and successful completion](#y-stream-upgrade-4193-to-4205-with-failure-recovery-and-successful-completion)
  - [y-stream upgrade timeout when upgrading from 4.20.5 to 4.21.2](#y-stream-upgrade-timeout-when-upgrading-from-4205-to-4212)
  - [Terminal failure recovery from 4.21.2 to 4.20.5](#terminal-failure-recovery-from-4212-to-4205)
  - [EUS upgrade timeout when upgrading from 4.20.5 to 4.22.4 via 4.21.6](#eus-upgrade-timeout-when-upgrading-from-4205-to-4224-via-4216)
  - [Terminal failure recovery after EUS timeout from 4.22.4 to 4.20.5](#terminal-failure-recovery-after-eus-timeout-from-4224-to-4205)
  - [EUS upgrade 4.20.5 to 4.22.4 via 4.21.7 with failure recovery and successful completion](#eus-upgrade-4205-to-4224-via-4217-with-failure-recovery-and-successful-completion)
- [MNO Day2 Hardware Configuration test [mno-day2-hw-updates]](#mno-day2-hardware-configuration-test-mno-day2-hw-updates)
  - [Performs day2 hardware configuration update successfully](#performs-day2-hardware-configuration-update-successfully)
  - [Handles day2 hardware configuration update with BMH error](#handles-day2-hardware-configuration-update-with-bmh-error)
  - [Handles mid-flight profile change by abandoning stale updates](#handles-mid-flight-profile-change-by-abandoning-stale-updates)
- [MNO Scale-Out test [mno-scale-out]](#mno-scale-out-test-mno-scale-out)
  - [Scale-out: add a worker node](#scale-out-add-a-worker-node)
  - [Scale-in: remove a worker node](#scale-in-remove-a-worker-node)
- [SNO End-to-end ProvisioningRequestReconcile with hardware manager [sno-provisioning]](#sno-end-to-end-provisioningrequestreconcile-with-hardware-manager-sno-provisioning)

## MNO Standard ClusterVersion Upgrade [mno-cv-upgrade]

File: `test/e2e/mno_cv_upgrade_test.go`

- Creating namespaces
- Creating ClusterTemplates and supporting resources
- Creating BMHs resources
- Creating ProvisioningRequest referencing CT v4-19-3-v1
- Waiting for ClusterInstance creation and simulating provisioning completion
- Waiting for PR to reach Fulfilled
- Creating ManagedClusterAddOn for the cluster
- Setting up spoke client mock at version 4.19.3
- Deleting created resources

### y-stream upgrade 4.19.3 to 4.20.5 with failure recovery and successful completion

1. should fail with version mismatch when PR overrides desiredUpdate.version
1. should report CV's Upgradeable=False after fixing version
1. should report CV's RetrievedUpdates=False after fixing Upgradeable
1. should report target not available when graph has no target
1. should trigger upgrade after channel update and CV's target available
1. should show InProgress with CV's Progressing message
1. should complete upgrade and return to fulfilled

### y-stream upgrade timeout when upgrading from 4.20.5 to 4.21.2

1. should start upgrade to 4.21.2 and reach InProgress
1. should time out when clusterUpgradeTimeout is set to 5s

### Terminal failure recovery from 4.21.2 to 4.20.5

1. should recover to fulfilled when switching back to CT matching current ClusterVersion 4.20.5

### EUS upgrade timeout when upgrading from 4.20.5 to 4.22.4 via 4.21.6

1. should start EUS intermediate upgrade and reach InProgress
1. should time out during EUS intermediate upgrade

### Terminal failure recovery after EUS timeout from 4.22.4 to 4.20.5

1. should recover to fulfilled when switching back to CT matching current ClusterVersion 4.20.5

### EUS upgrade 4.20.5 to 4.22.4 via 4.21.7 with failure recovery and successful completion

1. should fail with MCPs not updated
1. should fail with invalid intermediateVersion after fixing MCPs
1. should auto-select intermediateVersion and start intermediate upgrade
1. should show intermediate upgrade in progress
1. should start target upgrade after intermediate completes
1. should show target upgrade in progress
1. should wait for MCPs to update after target upgrade completes
1. should complete EUS upgrade when MCPs are updated

## MNO Day2 Hardware Configuration test [mno-day2-hw-updates]

File: `test/e2e/mno_hw_configuration_test.go`

- Creating namespaces
- Creating ClusterTemplate, HardwareProfiles, and supporting resources
- Creating 11 BMHs with BMC secrets, HardwareData, HFS, and HFC
- Waiting for all 11 BMHs to be visible via List
- Waiting for ClusterTemplate reconciliation
- Creating ProvisioningRequest with v1 hwProfiles (basic BIOS settings)
- Waiting for NAR creation
- Waiting for all 11 AllocatedNodes to be created
- Waiting for day0 to complete (NAR Provisioned=True)
- Waiting for PR HardwareProvisioned=True
- Simulating AllocatedNodeHostMap on PR
- Deleting created resources

### Performs day2 hardware configuration update successfully

1. Should update the PR with new hwProfiles and trigger configuration update
1. Should detect HW configuration changes and begin update process (NAR InProgress=True)
1. Should PR reach InProgress
1. Should complete rolling update: masters first (maxUnavailable=1), then workers (maxUnavailable=3)
   - Polling and advancing BMH state transitions for each node
   - Waiting for NAR to reach ConfigApplied
1. Should PR reach HardwareConfigured=True

### Handles day2 hardware configuration update with BMH error

1. Should update the PR with v3 worker profile (masters unchanged)
1. Should detect worker configuration changes and begin update (NAR InProgress)
1. Should PR reach InProgress
1. Should fail when one worker BMH enters error state during update
   - Finding the first in-progress worker
   - Failing the worker BMH
   - Waiting for the worker node to reach Failed
   - Waiting for NAR to reach Configured=False/Failed
1. Should PR reach HardwareConfigured=Failed

### Handles mid-flight profile change by abandoning stale updates

1. Should update PR with v1 worker profile requiring BIOS and firmware changes
1. Should have 3 workers in ConfigUpdate and advance one BMH to Servicing
   - Detect worker configuration changes and begin update (NAR InProgress)
   - Waiting for at least 3 workers in ConfigUpdate with v1 profile
   - Picking one worker and advancing its BMH to Servicing with config-in-progress
1. Should change to v2 worker profile mid-flight, defer abandon for Servicing worker, then converge all
   - Changing worker profile to v2 while v1 updates are in-flight
   - Waiting for 7 workers to converge to v2 while Servicing worker defers abandon
   - Verifying the Servicing worker is still in ConfigUpdate with v1 profile (deferred abandon)
   - Transitioning the Servicing BMH to OK to allow deferred abandon
   - Waiting for NAR to reach ConfigApplied after all workers converge
   - Verifying all 8 worker nodes converged to v2 profile
1. Should PR reach HardwareConfigured=True

## MNO Scale-Out test [mno-scale-out]

File: `test/e2e/mno_scale_test.go`

- Creating namespaces
- Creating ConfigMaps
- Creating ClusterTemplate and supporting resources
- Creating 6 BMHs (3 masters + 3 workers: 2 initial + 1 extra for scale-out)
- Waiting for all 6 BMHs to be visible
- Waiting for ClusterTemplate reconciliation
- Creating initial ProvisioningRequest with 3 masters + 2 workers
- Waiting for NAR creation
- Verifying initial NAR NodeGroup sizes
- Waiting for all 5 AllocatedNodes to be created
- Waiting for NAR Provisioned=True
- Waiting for PR HardwareProvisioned=True
- Capturing initial AllocatedNode names before scale-out
- Simulating AllocatedNodeHostMap on PR
- Simulating ClusterProvisioned=Completed on PR
- Cleaning up scale test resources

### Scale-out: add a worker node

1. should increase NAR worker NodeGroup Size after PR update
   - Creating CI defaults v2 with 3 workers and a new CT version
   - Waiting for new CT reconciliation
   - Updating PR to use new CT version and add worker-3
   - Verifying NAR NodeGroup sizes after scale-out
1. should create a new AllocatedNode for the added worker
   - Waiting for 6 AllocatedNodes (3 masters + 3 workers)
   - Verifying original nodes are preserved and new node is a worker

### Scale-in: remove a worker node

1. should decrease NAR worker NodeGroup Size after removing a worker
   - Updating PR to remove worker-3 (revert to v1 CT with 2 workers)
   - Verifying NAR NodeGroup sizes after scale-in

## SNO End-to-end ProvisioningRequestReconcile with hardware manager [sno-provisioning]

File: `test/e2e/sno_provisioning_test.go`

- Creating namespaces, ConfigMaps, and ClusterImageSet
- Creating ClusterTemplates
- Creating BMH pool namespace, HardwareProfile, and 4 BMHs with HardwareData
- Updating BMH status with hardware details and setting Available state
- Waiting for ClusterTemplate reconciliation
- Deleting created resources

1. Verify status conditions if ClusterInstance rendering fails
   - Creating ProvisioningRequest with incomplete ClusterTemplate
   - Waiting for validation and render failure conditions
1. Starts hardware provisioning
   - Creating ProvisioningRequest with complete ClusterTemplate
   - Waiting for hardware provisioning to start
1. Creates NodeAllocationRequest and AllocatedNode
   - Waiting for NodeAllocationRequest to be created
   - Waiting for AllocatedNode to be created by hardware manager
1. Updates the BMHs with the right labels
   - Verifying bmh-2 was selected over bmh-4 despite identical criteria
   - Verifying non-selected BMHs do not have allocation labels
1. NodeAllocationRequest and AllocatedNode complete
   - Verifying FirmwareUpdateNeeded annotation on selected BMH
   - Transitioning BMH to Preparing state
   - Waiting for config-in-progress annotation on AllocatedNode
   - Updating HostFirmwareComponents status to match HardwareProfile
   - Creating PreprovisioningImage and transitioning BMH to Available
   - Waiting for NAR and AllocatedNode to reach Provisioned=True
1. Completes hardware provisioning
   - Waiting for HardwareProvisioned condition to become True
1. Skips re-rendering the ClusterInstance when configuration changes occur during active provisioning
   - Waiting for PR to move past hardware provisioning to cluster installation
   - Changing template version to trigger re-render attempt
   - Verifying ClusterInstance is not re-rendered during active provisioning
