Skip to content

Conversation

@abeisemb
Copy link
Collaborator

@abeisemb abeisemb commented Sep 2, 2025

Description: Regression test collection is failing at the collection phase due to missing init.py files under dirsrvtests/tests/suites/webui. This causes the collection of monitoring_test.py to error out and prematurely end regression test runs. Even though the tests under monitoring_test.py are usually skipped unless run from a WebUI environment, a failure to collect them will still cause the full test run to fail.
This MR pulls the init.py files from 389-ds-base-2.2 and places them under webui and webui/monitoring.

Resolves: #6963

Summary by Sourcery

Ensure pytest can discover and properly execute WebUI tests by adding package initializers and defining shared helpers and fixtures

Bug Fixes:

  • Add missing init.py files under webui and monitoring directories to fix regression test collection errors

Enhancements:

  • Introduce common WebUI utilities and fixtures including setup_page fixture, login flow, frame handling, and instance removal helpers

Description: Regression test collection is failing at the collection phase
due to missing __init__.py files under dirsrvtests/tests/suites/webui.
This causes the collection of monitoring_test.py to fail.

Resolves: 389ds#6963
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 2, 2025

Reviewer's Guide

Enable proper pytest collection for WebUI tests by adding package initializers under the webui directory, including common fixtures, utilities, and skip logic for Playwright-based tests.

File-Level Changes

Change Details Files
Introduce webui package initializer with helper functions and fixtures for WebUI tests
  • Imported pytest, distro, os, time and lib389 modules
  • Added pytest.importorskip for Playwright
  • Implemented cockpit version checks and iframe selection/waiting helpers
  • Defined instance removal helpers via library and WebUI flows
  • Created setup_login function for automated WebUI login
  • Added setup_page pytest fixture with teardown finalizer
dirsrvtests/tests/suites/webui/__init__.py
Add monitoring subpackage initializer to enable monitoring tests collection
  • Added requirement docstring for WebUI: Monitoring
dirsrvtests/tests/suites/webui/monitoring/__init__.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Use subprocess.check_output and packaging.version.parse for version queries and comparisons instead of os.popen and raw string comparisons.
  • Simplify the timeout loop in check_frame_assignment to use an elapsed-time check (e.g. while elapsed < timeout) rather than comparing floats to avoid potential infinite loops.
  • The setup_page fixture doesn’t return any object—make sure it returns the necessary context (e.g. the page or topology) for tests to consume.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Use subprocess.check_output and packaging.version.parse for version queries and comparisons instead of os.popen and raw string comparisons.
- Simplify the timeout loop in check_frame_assignment to use an elapsed-time check (e.g. while elapsed < timeout) rather than comparing floats to avoid potential infinite loops.
- The setup_page fixture doesn’t return any object—make sure it returns the necessary context (e.g. the page or topology) for tests to consume.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@abeisemb
Copy link
Collaborator Author

abeisemb commented Sep 2, 2025

This commit allows collection of webui/monitoring to succeed, but I haven't figured out how to verify the test run yet. Need to find a way to set up a WebUI environment.

@abeisemb abeisemb marked this pull request as draft September 2, 2025 17:26
@abeisemb abeisemb marked this pull request as ready for review September 10, 2025 14:00
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