Skip to content

assert default bmc provider#514

Merged
evgeni merged 1 commit into
theforeman:masterfrom
arvind4501:extend-bmc-test
May 20, 2026
Merged

assert default bmc provider#514
evgeni merged 1 commit into
theforeman:masterfrom
arvind4501:extend-bmc-test

Conversation

@arvind4501
Copy link
Copy Markdown
Contributor

@arvind4501 arvind4501 commented May 20, 2026

Why are you introducing these changes? (Problem description, related links)

Extend BMC test to assert default bmc provider using /v2/features api

What are the changes introduced in this pull request?

  • extended bmc test

How to test this pull request

Steps to reproduce:

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

@evgeni
Copy link
Copy Markdown
Member

evgeni commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Review Change Stack

Walkthrough

This pull request adds a single test function to verify that the Foreman proxy correctly reports the BMC default provider setting. The test calls the proxy /v2/features endpoint, retrieves the BMC settings from the response, and asserts that the bmc_default_provider value is set to 'ipmitool'. The change is minimal, adding 7 lines under the bmc feature marker.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title 'assert default bmc provider' directly describes the main change: adding an assertion for the default BMC provider in tests.
Description check ✅ Passed The description is related to the changeset, explaining the intent to extend BMC tests to assert the default provider using the /v2/features API.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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)
tests/foreman_proxy_test.py (1)

70-72: ⚡ Quick win

Assert bmc/settings presence before dereferencing for clearer failures.

Right now a schema regression produces KeyError/AttributeError instead of a precise assertion failure about missing BMC data.

Proposed patch
 `@pytest.mark.feature`('bmc')
 def test_bmc_default_provider(server, certificates, server_fqdn):
     features = get_proxy_v2_features(server, certificates, server_fqdn)
-    settings = features['bmc'].get('settings', {})
+    assert 'bmc' in features
+    settings = features['bmc'].get('settings')
+    assert isinstance(settings, dict)
     assert settings.get('bmc_default_provider') == 'ipmitool'
🤖 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 `@tests/foreman_proxy_test.py` around lines 70 - 72, The test dereferences
features['bmc'] and its 'settings' without asserting their presence, which
raises KeyError/AttributeError on schema regressions; before checking
'bmc_default_provider', add explicit assertions that features contains 'bmc' and
that features['bmc'] has a 'settings' dict (or non-None), then retrieve settings
= features['bmc'].get('settings', {}) and assert
settings.get('bmc_default_provider') == 'ipmitool' so failures show clear
messages about missing 'bmc' or 'settings' rather than low-level exceptions;
reference get_proxy_v2_features, features, settings, 'bmc', and
'bmc_default_provider' when making the changes.
🤖 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 `@tests/foreman_proxy_test.py`:
- Around line 70-72: The test dereferences features['bmc'] and its 'settings'
without asserting their presence, which raises KeyError/AttributeError on schema
regressions; before checking 'bmc_default_provider', add explicit assertions
that features contains 'bmc' and that features['bmc'] has a 'settings' dict (or
non-None), then retrieve settings = features['bmc'].get('settings', {}) and
assert settings.get('bmc_default_provider') == 'ipmitool' so failures show clear
messages about missing 'bmc' or 'settings' rather than low-level exceptions;
reference get_proxy_v2_features, features, settings, 'bmc', and
'bmc_default_provider' when making the changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f3d5dd26-90b3-4cf2-900b-1c42992db086

📥 Commits

Reviewing files that changed from the base of the PR and between 3f6912d and e9ca1da.

📒 Files selected for processing (1)
  • tests/foreman_proxy_test.py

@evgeni evgeni merged commit 920639e into theforeman:master May 20, 2026
12 of 14 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 20, 2026
2 tasks
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