Skip to content

updated kcm flaky test #8508

Merged
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
danlavu:tests-kcm
Mar 13, 2026
Merged

updated kcm flaky test #8508
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
danlavu:tests-kcm

Conversation

@danlavu

@danlavu danlavu commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@danlavu
danlavu marked this pull request as draft March 9, 2026 21:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request attempts to fix a flaky test by increasing a timeout. However, the review identifies a fundamental logic flaw in the test itself. The ticket lifetime is shorter than the sleep duration, causing the ticket to expire before the test can check for renewal. The proposed change exacerbates this issue. A recommendation is made to adjust the ticket lifetime parameters to ensure the test correctly validates the renewal functionality.

Comment thread src/tests/system/tests/test_kcm.py
@danlavu
danlavu marked this pull request as ready for review March 9, 2026 22:56
@danlavu danlavu changed the title increaing timeout updating kcm test logic Mar 9, 2026
@danlavu danlavu changed the title updating kcm test logic updated kcm flaky test Mar 9, 2026
@danlavu

danlavu commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated the renewable times to match Gemini's suggestions.

@spoore1 spoore1 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. Fixing this test should resolve one of the failures we've seen recently.

@alexey-tikhonov

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request attempts to fix a flaky test by increasing a time.sleep() duration. While this might reduce the flakiness, a more robust solution is to replace the fixed sleep with a polling mechanism that actively waits for the asynchronous operation to complete. I've provided a suggestion to implement this, which will make the test more reliable.

Comment on lines +388 to 389
time.sleep(5)
renew_start, _ = krb.list_tgt_times(kdc.realm)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Using a fixed time.sleep() to wait for an asynchronous operation like ticket renewal can lead to flaky tests. The operation might take longer than the sleep duration on slower systems or under high load, causing the test to fail intermittently.

A more robust approach is to actively poll for the expected condition (the ticket being renewed) with a reasonable timeout. This makes the test more reliable as it waits for the renewal to actually happen.

            renew_start = init_start
            for _ in range(10):
                try:
                    current_start, _ = krb.list_tgt_times(kdc.realm)
                    if init_start < current_start:
                        renew_start = current_start
                        break
                except ProcessError:
                    pass
                time.sleep(0.5)

@alexey-tikhonov

Copy link
Copy Markdown
Member

LGTM. Fixing this test should resolve one of the failures we've seen recently.

It's a symptomatic fix.

Ok, let's merge it, but chances are it will re-appear.

Reviewed-by: Scott Poore <[email protected]>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov 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-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-44-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Analyze (target) / cppcheck (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-42) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🟢 ci / intgcheck (fedora-45) (success)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-42) (success)
🟢 ci / system (fedora-43) (success)
🟢 ci / system (fedora-44) (success)
🟢 ci / system (fedora-45) (success)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (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.

@alexey-tikhonov
alexey-tikhonov merged commit 77fc6ff into SSSD:master Mar 13, 2026
8 of 13 checks passed
@danlavu
danlavu deleted the tests-kcm branch July 1, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted backport-to-sssd-2-12 Trivial A single reviewer is sufficient to review the Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants