Skip to content

HYPERFLEET-1017 - refactor: update for LastKnownReconciled rename#107

Open
rafabene wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
rafabene:rbenevid/HYPERFLEET-1017/rename-available-to-last-known-reconciled
Open

HYPERFLEET-1017 - refactor: update for LastKnownReconciled rename#107
rafabene wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
rafabene:rbenevid/HYPERFLEET-1017/rename-available-to-last-known-reconciled

Conversation

@rafabene
Copy link
Copy Markdown
Contributor

@rafabene rafabene commented May 5, 2026

Summary

Dependencies

Changed files

  • internal/client/client_test.go — test fixtures
  • internal/config/config_test.go — CEL expression in default config test
  • internal/engine/decision_test.go — decision engine test fixtures and assertions
  • test/integration/integration_test.go — integration test fixtures
  • test/mock-hyperfleet-api/main.go — mock server condition type

Test plan

  • All unit tests pass (go test ./...)
  • Integration tests pass

Summary by CodeRabbit

  • Tests
    • Updated test fixtures, unit tests, integration tests, and test mocks to replace the "Available" status condition with "LastKnownReconciled", adjusting expectations and lookups so assertions reflect the new condition name.

@openshift-ci openshift-ci Bot requested review from ma-hill and rh-amarin May 5, 2026 23:14
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ma-hill for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Walkthrough

This change updates test fixtures and mock data across multiple test files, replacing references to the "Available" status condition type with "LastKnownReconciled". Updates appear in cluster and nodepool mocks, configuration tests, decision engine tests (including a new subtest variation), integration test mocks, and a mock API response. No production logic, API signatures, or exported declarations are modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: updating test fixtures and configuration to reflect a rename from 'Available' to 'LastKnownReconciled' condition type.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@rafabene rafabene force-pushed the rbenevid/HYPERFLEET-1017/rename-available-to-last-known-reconciled branch from 1ee97d4 to e8e6647 Compare May 5, 2026 23:17
…ciled rename

The HyperFleet API renamed the aggregated Available condition to
LastKnownReconciled. Update all test fixtures, CEL expressions,
and the mock API server to match.
@rafabene rafabene force-pushed the rbenevid/HYPERFLEET-1017/rename-available-to-last-known-reconciled branch from e8e6647 to cb05508 Compare May 6, 2026 00:03
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/client/client_test.go (1)

44-45: ⚡ Quick win

Assert the renamed condition is actually parsed and present

Line 44 and Line 590 update fixtures to LastKnownReconciled, but the tests still only validate generic condition status/indexes. That means this rename can regress without failing this test file. Add an explicit assertion that at least one parsed condition has Type == "LastKnownReconciled" in both cluster and nodepool test paths.

Proposed test assertion pattern
+	foundLastKnownReconciled := false
+	for _, cond := range resources[0].Status.Conditions {
+		if cond.Type == "LastKnownReconciled" {
+			foundLastKnownReconciled = true
+			break
+		}
+	}
+	if !foundLastKnownReconciled {
+		t.Fatal("Expected LastKnownReconciled condition to be present")
+	}

Also applies to: 590-591

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/client/client_test.go` around lines 44 - 45, Tests updated fixtures
to use "LastKnownReconciled" but never assert the renamed condition is actually
parsed; add an explicit check in the cluster and nodepool test paths in
internal/client/client_test.go that verifies at least one parsed condition has
Type == "LastKnownReconciled". Locate the places where conditions are parsed
into a slice (e.g., variables named parsedConditions / conditions /
clusterConditions / nodepoolConditions or the test helpers that call the parsing
function) and add an assertion that iterates that slice and expects at least one
condition.Type == "LastKnownReconciled" (fail the test if none found).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/client/client_test.go`:
- Around line 44-45: Tests updated fixtures to use "LastKnownReconciled" but
never assert the renamed condition is actually parsed; add an explicit check in
the cluster and nodepool test paths in internal/client/client_test.go that
verifies at least one parsed condition has Type == "LastKnownReconciled". Locate
the places where conditions are parsed into a slice (e.g., variables named
parsedConditions / conditions / clusterConditions / nodepoolConditions or the
test helpers that call the parsing function) and add an assertion that iterates
that slice and expects at least one condition.Type == "LastKnownReconciled"
(fail the test if none found).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: b82262c2-eeae-438a-a5a9-228abe68af65

📥 Commits

Reviewing files that changed from the base of the PR and between e8e6647 and cb05508.

📒 Files selected for processing (5)
  • internal/client/client_test.go
  • internal/config/config_test.go
  • internal/engine/decision_test.go
  • test/integration/integration_test.go
  • test/mock-hyperfleet-api/main.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/engine/decision_test.go

makeCondition("Available", "True", "AllAdaptersAvailable",
"All adapters reported Available True for the same generation"),
makeCondition("LastKnownReconciled", "True", "AllAdaptersReconciled",
"All required adapters report Available=True for the tracked generation"),
Copy link
Copy Markdown
Contributor

@mliptak0 mliptak0 May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under this line you have some remaining occurence of Available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants