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: client install - add tests scenarios #6759

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

miskopo
Copy link
Member

@miskopo miskopo commented Mar 28, 2023

Add negative tests scenarios, parameter testing, replica joining tests, and other scenarios from downstream.

@miskopo miskopo added the WIP Work in progress - not ready yet for review label Mar 28, 2023
@miskopo miskopo self-assigned this Mar 28, 2023
'ntpd'])
assert result.returncode == 4 # service not found
finally:
tasks.uninstall_client(client)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't the IntegrationTest uninstall classmethod handle calling tasks.uninstall_client?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello @rcritten, thank you for your question. Yes, it should. However, when I omit manual clean-up, subsequent tests fail with "already configured". I'll investigate further. Stay tuned!

@miskopo miskopo added the re-run Trigger a new run of PR-CI label Mar 31, 2023
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Mar 31, 2023
@miskopo miskopo force-pushed the client_install_port branch 6 times, most recently from 2581440 to c7490e9 Compare April 6, 2023 13:26
@miskopo miskopo force-pushed the client_install_port branch 5 times, most recently from f919c82 to 28b67ad Compare April 13, 2023 14:38
@miskopo miskopo added needs review Pull Request is waiting for a review and removed WIP Work in progress - not ready yet for review labels Apr 13, 2023
authconf = client.get_file_contents('/etc/pam.d/system-auth',
encoding='utf-8')
exp_val_mkhomedir = "mkhomedir.so"
assert exp_val_mkhomedir in authconf
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question: would it be more robust to call authselect current and parse that output so the test doesn't rely on a setting in a specific file?

user=non_admin_user,
raiseonerr=False
)
exp_msg = "Password incorrect while getting initial credentials"
Copy link
Contributor

Choose a reason for hiding this comment

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

This error is unexpected. I'd expect something more like:

Joining realm failed: No permission to join this host to the IPA domain.

The password should have been properly set when the user was created so I think that that password isn't being passed into the installer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure about this one.

The non-admin user is created as an active one. So the password for them are set.
The client installation uses default admin password, if not provided with one explicitly.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rcritten do you happen to have any insight as what is happening here, please?

Copy link
Contributor

Choose a reason for hiding this comment

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

You create a test user with the password of RandomPassword123. The user password is made valid by tasks.create_active_user()
You then run the client install task as non_admin_user but you don't pass in the password. tasks.install_client() defaults to the admin password if you don't provide one. It doesn't match which is why this test passes with the expected error. I suppose it might be nicer to be explicit about passing in a different password, though you don't really need a non-admin user for that I suppose.

"""
Second installation should fail except when --force
parameter is provided
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

--force does not apply to uninstall


try:
modify_local_hostname('localhost.localdomain')
# client_install
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment why tasks.install_client() isn't used in this case because it will automatically fix hostnames.

assert result.returncode == 0

# now uninstall
tasks.uninstall_client(self.clients[0], raiseonerr=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you want a try/finally here on the off-chance the installation fails?

tasks.uninstall_client(self.clients[0], raiseonerr=True)

def tests_client_install_replica_with_master_down(self):
self.master.run_command(['ipactl', 'stop'], raiseonerr=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

This test doesn't appear in the report as far as I can tell.

@menonsudhir menonsudhir added WIP Work in progress - not ready yet for review and removed needs review Pull Request is waiting for a review labels Aug 1, 2023
@miskopo miskopo added re-run Trigger a new run of PR-CI tests Pull Request related to ipatests labels Sep 12, 2023
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Sep 12, 2023
@miskopo
Copy link
Member Author

miskopo commented Sep 14, 2023

Hello @rcritten , all issues seem to be resolved, could you please review? Thank you!

@miskopo miskopo added needs review Pull Request is waiting for a review and removed WIP Work in progress - not ready yet for review labels Sep 14, 2023
assert exp_msg.lower() in result.stderr_text.lower()

tasks.uninstall_client(self.clients[0], raiseonerr=True)

Copy link
Contributor

Choose a reason for hiding this comment

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

This is failing because the variable result contains the output from the last failed install. But even if you instead use result = tasks.uninstall_client() the message will still not match because the result will be successful. Did you want to run the uninstaller twice to check this message?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was a overlook from my side

Add negative tests scenarios, parameter testing, replica joining
tests, and other scenarios from downstream.

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Copy link

stale bot commented Mar 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale PR [Bot] label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Pull Request is waiting for a review stale Stale PR [Bot] tests Pull Request related to ipatests
Projects
None yet
4 participants