Skip to content

Skip tests for features not enabled and show pytest results#485

Open
ehelms wants to merge 1 commit intotheforeman:masterfrom
ehelms:feature-gated-tests
Open

Skip tests for features not enabled and show pytest results#485
ehelms wants to merge 1 commit intotheforeman:masterfrom
ehelms:feature-gated-tests

Conversation

@ehelms
Copy link
Copy Markdown
Member

@ehelms ehelms commented May 4, 2026

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

When certain features are not enabled, their tests are marked as failed which can make debugging confusing.

What are the changes introduced in this pull request?

  • Checks for feature enablement and skips tests if their feature is not enabled
  • Uses flavor + parameters.yaml to determine enabled features
  • Add get_enabled_features() and has_feature() helpers to conftest.py that replicate the Ansible enabled_features calculation by combining flavor_features with user features from parameters.yaml.
  • Use pytest.mark.skipif to gate tests on their required features: foreman-proxy, hammer, azure-rm, google, remote-execution, and iop.
  • Read the Foreman admin password from
    .var/lib/foremanctl/foreman-admin-init-passwd instead of hardcoding.
  • Update the test playbook to display pytest output before failing so pass/fail details are visible in Ansible output.

How to test this pull request

Steps to reproduce:

  • Run a deployment with some set of enabled features (e.g. foremanctl deploy --add-feature iop
  • Check which tests are skipped and ensure the list looks appropriate

Checklist

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

Add get_enabled_features() and has_feature() helpers to conftest.py
that replicate the Ansible enabled_features calculation by combining
flavor_features with user features from parameters.yaml. Use
pytest.mark.skipif to gate tests on their required features:
foreman-proxy, hammer, azure-rm, google, remote-execution, and iop.

Read the Foreman admin password from
.var/lib/foremanctl/foreman-admin-init-passwd instead of hardcoding.

Update the test playbook to display pytest output before failing so
pass/fail details are visible in Ansible output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant