Skip to content

tests: collapse su/ssh parametrization in test_gpo.py - #9401

Merged
danlavu merged 1 commit into
SSSD:masterfrom
danlavu:collapse-gpo-su-ssh-parametrize
Oct 11, 2026
Merged

danlavu merged 1 commit into
SSSD:masterfrom
danlavu:collapse-gpo-su-ssh-parametrize

Conversation

@danlavu

@danlavu danlavu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Drop parametrization of su and ssh and calls in the gpo tests. The setup and teardown in AD is costly. This is the same approach Jakub used in PR #9045 shaving 20 minutes on runtime.

AI: Claude Sonnet 5

@jakub-vavra-cz

jakub-vavra-cz commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

At a quick glance: make the assert messages mention su/ssh to make possible error more clear.

Group the asserts together the same way as the steps describing them:
steps:

  1. user1 is allowed on ssh and on su
  2. userdeny is blocked on ssh and on su
    ....

assert ssh(user1), "user1 was blocked on ssh!"
assert su(user1), "user1 was blocked on su!"
assert not ssh(userdeny), "userdeny was allowed on ssh!"
assert not su(userdeny), "userdeny was allowed on su!"

@jakub-vavra-cz jakub-vavra-cz left a comment •

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.

Mostly LGTM, just make sure to align order of asserts to steps and distinguish error message for ssh and su asserts. (see inline)

Different suggestion: If the steps+results are duplicated like this:

  1. deny ssh
  2. allow ssh
  3. deny su
  4. allow su

Then can the code be put in loop over method:

for method in ["ssh", "su"]:
    assert method(allow), "Failed {method}!"
    assert method(deny), "Allowed {method}!"

@danlavu

danlavu commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

I added the auth mechanism to the error messages, but I think I'm skipping the loop; it's not saving a lot of lines except for a few tests.

@danlavu
danlavu force-pushed the collapse-gpo-su-ssh-parametrize branch from e03a58b to b9b6db7 Compare October 8, 2026 13:12

@jakub-vavra-cz jakub-vavra-cz left a comment

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.

LGTM.

Drop parametrization of su and ssh and calls in the gpo tests. The setup and teardown
in AD is costly. This is the same approach Jakub used in PR SSSD#9045 shaving 20 minutes
on runtime.

AI: Claude Sonnet 5
Co-authored-by: Cursor <cursoragent@cursor.com>
Reviewed-by: Jakub Vávra <jvavra@redhat.com>
@sssd-bot

sssd-bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The pull request was accepted by @jakub-vavra-cz with the following PR CI status:


🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-44-x86_64:upstream (success)
🟢 rpm-build:fedora-45-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 testing-farm:centos-stream-10-x86_64:upstream (success)
🟢 testing-farm:fedora-43-x86_64:upstream (success)
🟢 testing-farm:fedora-44-x86_64:upstream (success)
🟢 testing-farm:fedora-45-x86_64:upstream (success)
🟢 testing-farm:fedora-rawhide-x86_64:upstream (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / intgcheck (fedora-45) (success)
🟢 ci / intgcheck (fedora-46) (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-43) (success)
🟢 ci / system (fedora-44) (success)
🟢 ci / system (fedora-45) (success)
🟢 ci / system (fedora-46) (success)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / files-changed (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

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.

3 participants