Skip to content

fix(tests): make user_groups integration tests distro-aware#6889

Open
mmummigatti wants to merge 1 commit into
canonical:mainfrom
mmummigatti:rhel-fix-user-group
Open

fix(tests): make user_groups integration tests distro-aware#6889
mmummigatti wants to merge 1 commit into
canonical:mainfrom
mmummigatti:rhel-fix-user-group

Conversation

@mmummigatti
Copy link
Copy Markdown

@mmummigatti mmummigatti commented May 20, 2026

The integration tests for users_groups module had Ubuntu-specific
assumptions that prevented them from running on RHEL-family systems.

Changes:

  • Add skipif decorators to Ubuntu-specific warning tests (test_initial_warnings,
    test_nopassword_unlock_warnings) since warning formats differ across distros
  • Remove redundant IS_UBUNTU checks inside skipif-decorated tests
  • Restore test_sudoers_includedir decorators with distro-aware skipif logic:
    'IS_UBUNTU and CURRENT_RELEASE < JAMMY' allows the test to run on RHEL
    and modern Ubuntu while skipping only on old Ubuntu releases lacking
    required sudo version
  • Add JAMMY import needed for the distro-aware skipif condition

These changes ensure tests either:

  1. Run on all distros with appropriate handling, or
  2. Skip gracefully on distros where the test isn't applicable

This allows the test suite to pass on both Ubuntu and RHEL-family systems.

Copy link
Copy Markdown
Contributor

@ani-sinha ani-sinha left a comment

Choose a reason for hiding this comment

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

Can you please check that tests pass with both RHEL and Ubuntu images?

Comment thread tests/integration_tests/modules/test_users_groups.py
warnings = (
[NEW_USER_EMPTY_PASSWD_WARNING.format(username="nopassworduser")]
if CURRENT_RELEASE > NOBLE
if IS_UBUNTU and CURRENT_RELEASE > NOBLE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems this would not be needed since you are skipping the test for non-Ubuntu case anyway. Can you try and removing this and checking if it worked on Fedora/RHEL.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay done!

Comment thread tests/integration_tests/modules/test_users_groups.py
)


# @pytest.mark.user_data(USER_DATA)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove these commented code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay will do that

Comment thread tests/integration_tests/modules/test_users_groups.py
Comment thread tests/integration_tests/modules/test_users_groups.py
@mmummigatti mmummigatti force-pushed the rhel-fix-user-group branch 2 times, most recently from 831efb8 to cc3f091 Compare May 29, 2026 09:00
Comment thread tests/integration_tests/modules/test_users_groups.py
require_warnings=warnings,
)

verify_clean_boot(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change does not make sense.

@mmummigatti mmummigatti force-pushed the rhel-fix-user-group branch from cc3f091 to c2f7817 Compare May 29, 2026 10:23
  The integration tests for users_groups module had Ubuntu-specific
  assumptions that prevented them from running on RHEL-family systems.

  Changes:
  - Add skipif decorators to Ubuntu-specific warning tests
  - Remove redundant IS_UBUNTU checks inside skipif-decorated tests
  - Restore test_sudoers_includedir decorators with distro-aware skipif
    logic: 'IS_UBUNTU and CURRENT_RELEASE < JAMMY' allows test to run
    on RHEL and modern Ubuntu while skipping old Ubuntu releases
  - Add JAMMY import needed for the distro-aware skipif condition
IS_UBUNTU,
JAMMY,
NOBLE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this space required?


verify_clean_boot(
class_client,
ignore_warnings=True, # ignore warnings about existing groups
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why remove this comment? Its not related to the change.

require_warnings=warnings,
)

)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is simply whitespace issues. There should be no changes here. Can you double check?

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