Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipatests: add missing automember-cli tests #6718

Closed
wants to merge 1 commit into from

Conversation

mbhalodi
Copy link
Collaborator

@mbhalodi mbhalodi commented Feb 28, 2023

This patch is focusing on negative test scenarios of automember-cli.

Related: https://pagure.io/freeipa/issue/9332

Signed-off-by: mbhalodi mbhalodi@redhat.com

@mbhalodi mbhalodi force-pushed the automember branch 11 times, most recently from d693ab5 to fe9b292 Compare March 9, 2023 09:50
@mbhalodi mbhalodi marked this pull request as ready for review March 10, 2023 05:07
@mbhalodi mbhalodi changed the title [WIP] ipatests: add missing automember-cli tests ipatests: add missing automember-cli tests Mar 10, 2023
@mbhalodi mbhalodi force-pushed the automember branch 3 times, most recently from c86cc61 to 1331a0a Compare March 13, 2023 11:19
@menonsudhir menonsudhir added the WIP Work in progress - not ready yet for review label Mar 13, 2023
badregextype_regex="qa[0-9]+.example.com")
with raises_exact(errors.NotFound(
reason=u'no such option: --badregextype-regex')):
command()
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is testing CLI parsing, not the automember plugin itself. It's fine in a way to exercise the parsing code but it isn't specific to this.

@miskopo
Copy link
Member

miskopo commented Mar 14, 2023

You can find the test failures here (It's little bit tricky to navigate in Azure)

@miskopo miskopo self-requested a review March 14, 2023 13:33
Copy link
Member

@miskopo miskopo left a comment

Choose a reason for hiding this comment

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

Please see the in-line comments. The main problem is with incorrect Error type and missing/exists requirement

ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @mbhalodi
to make the code easier to read, I would structure it with fewer classes. For instance, use a single class for all the negative tests related to automember-find, use another one for automember-show etc...
Inside each class, add functions to test each parameter (with non existent group, with bad type ...)

ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
@mbhalodi mbhalodi force-pushed the automember branch 2 times, most recently from fce90f0 to 4501f6c Compare March 15, 2023 19:22
Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @mbhalodi
please find a few inline comments

ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
@mbhalodi mbhalodi force-pushed the automember branch 2 times, most recently from e26bcb4 to 47ceedc Compare March 24, 2023 18:16
@mbhalodi
Copy link
Collaborator Author

To note that, to resolve the Tox issue, Flo made a separate PR #6758.
Once that PR gets merged, I will rebase on top of the master branch.

@amore17 amore17 added the re-run Trigger a new run of PR-CI label Mar 27, 2023
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Mar 27, 2023
@rcritten
Copy link
Contributor

The tox failure is being addressed in: #6758

The GATING_upgrade test is unfortunately a bit flaky at times and sometimes requires multiple re-runs for it to pass. I'd wait until is fixed and you rebase on top of that to attempt multiple re-runs because you'd have to do it all again later anyway.

@flo-renaud
Copy link
Contributor

@mbhalodi PR#6758 has been merged and should fix the tox issue. Please rebase on top of the master branch.

Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @mbhalodi
Thanks for the update. Please find my inline comments.

""" Try to find a rule with non-existent group/hostgroup """
grp = request.getfixturevalue(grp)
automember_grp = request.getfixturevalue(automember_grp)
grp.ensure_missing()
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be automember_grp.ensure_missing().
The function can be simplified and use only automember_grp + request parameters (grp is not useful here).

ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
@flo-renaud
Copy link
Contributor

@mbhalodi
pycodestyle and lint detected the following issues:

./ipatests/test_xmlrpc/test_automember_plugin.py:220:81: E501 line too long (84 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:226:81: E501 line too long (87 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:254:81: E501 line too long (82 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:293:81: E501 line too long (82 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:299:81: E501 line too long (87 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:520:81: E501 line too long (84 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:527:81: E501 line too long (87 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:696:54: E128 continuation line under-indented for visual indent
./ipatests/test_xmlrpc/test_automember_plugin.py:703:81: E501 line too long (88 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:712:54: E128 continuation line under-indented for visual indent
./ipatests/test_xmlrpc/test_automember_plugin.py:719:81: E501 line too long (88 > 80 characters)
./ipatests/test_xmlrpc/test_automember_plugin.py:728:51: E128 continuation line under-indented for visual indent
./ipatests/test_xmlrpc/test_automember_plugin.py:743:51: E128 continuation line under-indented for visual indent

and

************* Module ipatests.test_xmlrpc.test_automember_plugin
ipatests/test_xmlrpc/test_automember_plugin.py:733: [W0612(unused-variable), TestAutomemberAddConditionNegative.test_create_inclusive_with_existent_automember] Unused variable 'command')
ipatests/test_xmlrpc/test_automember_plugin.py:748: [W0612(unused-variable), TestAutomemberAddConditionNegative.test_create_exclusive_with_existent_automember] Unused variable 'command')

@mbhalodi mbhalodi force-pushed the automember branch 4 times, most recently from 9806ebf to 15275f6 Compare March 31, 2023 10:19
Copy link
Contributor

@flo-renaud flo-renaud left a comment

Choose a reason for hiding this comment

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

Hi @mbhalodi
thanks for the update, we're almost done!
I have a few nitpicks related to the comments but otherwise the code LGTM.

ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
ipatests/test_xmlrpc/test_automember_plugin.py Outdated Show resolved Hide resolved
@amore17 amore17 added needs review Pull Request is waiting for a review ipa-4-9 Mark for backport to ipa 4.9 ipa-4-10 Mark for backport to ipa 4.10 and removed WIP Work in progress - not ready yet for review labels Apr 3, 2023
Revisit the bash tests and port the valid
tests to upstream.

Related: https://pagure.io/freeipa/issue/9332

Signed-off-by: mbhalodi <mbhalodi@redhat.com>
@flo-renaud flo-renaud added ack Pull Request approved, can be merged pushed Pull Request has already been pushed and removed needs review Pull Request is waiting for a review labels Apr 3, 2023
@flo-renaud
Copy link
Contributor

master:

  • 4119e4e ipatests: add missing automember-cli tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged ipa-4-9 Mark for backport to ipa 4.9 ipa-4-10 Mark for backport to ipa 4.10 pushed Pull Request has already been pushed
Projects
None yet
8 participants