-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
test: Factorize and fix timeout for contacting domain #19615
Merged
martinpitt
merged 3 commits into
cockpit-project:main
from
martinpitt:realms-address-helper
Nov 16, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,15 @@ ExecStart=/bin/true | |
|
||
@testlib.skipDistroPackage() | ||
class CommonTests: | ||
|
||
def wait_discover(self): | ||
with self.browser.wait_timeout(60): | ||
self.browser.wait_attr("#realms-op-address", "data-discover", "done") | ||
|
||
def wait_address_helper(self, expected=None): | ||
with self.browser.wait_timeout(60): | ||
self.browser.wait_text("#realms-op-address-helper", expected or "Contacted domain") | ||
|
||
@testlib.timeout(900) | ||
def testQualifiedUsers(self): | ||
m = self.machine | ||
|
@@ -114,7 +123,7 @@ class CommonTests: | |
b.click(self.domain_sel) | ||
b.wait_popup("realms-join-dialog") | ||
wait_domain_detected() | ||
b.wait_text("#realms-op-address-helper", "Contacted domain") | ||
self.wait_address_helper() | ||
# admin gets auto-detected | ||
b.wait_val(self.op_admin, self.admin_user) | ||
b.set_input_text(self.op_admin_password, self.admin_password) | ||
|
@@ -142,8 +151,9 @@ class CommonTests: | |
b.logout() | ||
|
||
# wait until IPA user works | ||
m.execute('while ! su - -c "echo %s | sudo -S true" %[email protected]; do sleep 5; sss_cache -E || true; systemctl try-restart sssd; done' % ( | ||
self.admin_password, self.admin_user), timeout=300) | ||
m.execute(f'while ! su - -c "echo {self.admin_password} | sudo -S true" {self.admin_user}@cockpit.lan; do ' | ||
' sleep 5; sss_cache -E || true; systemctl reset-failed sssd; systemctl try-restart sssd; done', | ||
timeout=300) | ||
|
||
# change existing local "admin" home dir to domain "admin" user | ||
m.execute(f"chown -R {self.admin_user}@cockpit.lan /home/admin") | ||
|
@@ -197,7 +207,7 @@ class CommonTests: | |
# b.assert_pixels("#realms-leave-dialog", "realm-leave", [".pf-v5-c-expandable-section__toggle-icon"]) | ||
b.click("#realms-op-leave") | ||
|
||
with b.wait_timeout(30): | ||
with b.wait_timeout(60): | ||
b.wait_not_present("#realms-leave-dialog") | ||
wait_number_domains(0) | ||
# re-enables hostname changing | ||
|
@@ -253,19 +263,17 @@ class CommonTests: | |
# wait for auto-detection | ||
wait_domain_detected() | ||
b.set_input_text(self.op_address, "NOPE") | ||
with b.wait_timeout(30): | ||
b.wait_text("#realms-op-address-helper", "Domain could not be contacted") | ||
self.wait_address_helper("Domain could not be contacted") | ||
b.wait_visible(f"#realms-join-dialog button{self.primary_btn_class}:disabled") | ||
b.click("#realms-join-dialog button.pf-m-link") | ||
b.wait_not_present("#realms-join-dialog") | ||
|
||
# Join a domain with the server as address (input differs from domain name) | ||
b.click(self.domain_sel) | ||
b.wait_popup("realms-join-dialog") | ||
b.wait_attr("#realms-op-address", "data-discover", "done") | ||
self.wait_discover() | ||
b.set_input_text(self.op_address, "f0.cockpit.lan") | ||
with b.wait_timeout(60): | ||
b.wait_text("#realms-op-address-helper", "Contacted domain") | ||
self.wait_address_helper() | ||
# admin gets auto-detected | ||
b.wait_val(self.op_admin, self.admin_user) | ||
b.set_input_text(self.op_admin_password, self.admin_password) | ||
|
@@ -353,16 +361,17 @@ class CommonTests: | |
self.login_and_go("/system") | ||
b.click("#system_information_domain_button") | ||
b.wait_popup("realms-join-dialog") | ||
b.wait_attr("#realms-op-address", "data-discover", "done") | ||
self.wait_discover() | ||
|
||
b.set_input_text("#realms-op-address", "cockpit.lan") | ||
b.wait_text("#realms-op-address-helper", "Contacted domain") | ||
self.wait_address_helper() | ||
b.set_input_text("#realms-op-admin", self.admin_user) | ||
b.set_input_text("#realms-op-admin-password", self.admin_password) | ||
b.click(f"#realms-join-dialog button{self.primary_btn_class}") | ||
with b.wait_timeout(300): | ||
b.wait_not_present("#realms-join-dialog") | ||
b.logout() | ||
m.execute('while ! id alice; do sleep 5; systemctl restart sssd; done', timeout=300) | ||
m.execute('while ! id alice; do sleep 5; systemctl reset-failed sssd; systemctl restart sssd; done', timeout=300) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Annoying still flakes here, but can be a follow up. |
||
|
||
# alice's certificate was written by testClientCertAuthentication() | ||
alice_cert_key = ['--cert', "/var/tmp/alice.pem", '--key', "/var/tmp/alice.key"] | ||
|
@@ -673,9 +682,9 @@ class TestIPA(TestRealms, CommonTests): | |
# Join cockpit.lan | ||
b.click(self.domain_sel) | ||
b.wait_popup("realms-join-dialog") | ||
b.wait_attr("#realms-op-address", "data-discover", "done") | ||
self.wait_discover() | ||
b.set_input_text(self.op_address, "cockpit.lan") | ||
b.wait_in_text("#realms-op-address-helper", "Domain is not supported") | ||
self.wait_address_helper("Domain is not supported") | ||
# no admin name auto-detection for unsupported domains | ||
b.wait_val(self.op_admin, "") | ||
b.set_input_text(self.op_admin, self.admin_user) | ||
|
@@ -1210,7 +1219,8 @@ class TestPackageInstall(packagelib.PackageCase): | |
b.wait_visible("#realms-join-dialog") | ||
|
||
# no auto-detected domain/admin | ||
b.wait_attr("#realms-op-address", "data-discover", "done") | ||
with b.wait_timeout(60): | ||
b.wait_attr("#realms-op-address", "data-discover", "done") | ||
self.assertEqual(b.val("#realms-op-address"), "") | ||
self.assertEqual(b.val("#realms-op-admin"), "") | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have been
expected="Contacted domain"
which is a bit nicer I'd say. Anyway not critical.