Skip to content

Smartcard multi token tests#8519

Merged
sumit-bose merged 1 commit into
SSSD:masterfrom
krishnavema:smartcard-multi-token-tests
Apr 29, 2026
Merged

Smartcard multi token tests#8519
sumit-bose merged 1 commit into
SSSD:masterfrom
krishnavema:smartcard-multi-token-tests

Conversation

@krishnavema

Copy link
Copy Markdown
Contributor

No description provided.

@krishnavema
krishnavema requested a review from spoore1 March 15, 2026 16:12

@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 introduces system tests for multi-token smartcard authentication. It includes new helper functions for setting up tokens and authenticating, along with several test cases covering different scenarios with two tokens. A key change is updating the sssd-test-framework dependency to a personal fork to support these new tests. My review focuses on the risk associated with this dependency and on improving the maintainability and robustness of the new test code by addressing magic numbers and polling logic.

Comment thread src/tests/system/requirements.txt Outdated
git+https://github.com/next-actions/pytest-tier
git+https://github.com/next-actions/pytest-output
git+https://github.com/SSSD/sssd-test-framework
git+https://github.com/krishnavema/sssd-test-framework@multi-token-smart-card-support

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

This change introduces a dependency on a personal fork (krishnavema/sssd-test-framework). While this might be acceptable for development, it poses a security and maintenance risk for the main branch. The changes from this fork should be merged into the upstream SSSD/sssd-test-framework repository, and the dependency should point to an official release or commit from the upstream repository before this pull request is merged.

git+https://github.com/SSSD/sssd-test-framework

Comment thread src/tests/system/tests/test_smartcard.py
Comment thread src/tests/system/tests/test_smartcard.py Outdated

@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.

This is a good start. I've run into a couple snags with testing but basics are working so here's a start for review.

Comment thread src/tests/system/tests/test_smartcard.py Outdated
Comment thread src/tests/system/tests/test_smartcard.py Outdated
Comment thread src/tests/system/tests/test_smartcard.py Outdated
@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 2592a18 to 1322416 Compare March 20, 2026 08:01
@krishnavema
krishnavema marked this pull request as ready for review March 20, 2026 08:02
@krishnavema
krishnavema requested a review from spoore1 March 20, 2026 08:03
@alexey-tikhonov

Copy link
Copy Markdown
Member

'changes requested': all platforms fail test_smartcard__two_tokens_match_on_both

@spoore1

spoore1 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

'changes requested': all platforms fail test_smartcard__two_tokens_match_on_both

We're investigating this issue now. I hadn't looked at the test failures yet because I was hitting this one locally.

@krishnavema
krishnavema marked this pull request as draft March 27, 2026 12:20
@sumit-bose

Copy link
Copy Markdown
Contributor

Hi,

please try to run the tests with #8629, his PR should hopefully fix the issue with test_smartcard__two_tokens_match_on_both.

bye,
Sumit

@spoore1

spoore1 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Hi,

please try to run the tests with #8629, his PR should hopefully fix the issue with test_smartcard__two_tokens_match_on_both.

bye, Sumit

Yes, I can confirm that fixes the failure. I posted to that PR as well.

I tested on Fedora 42 containers and I can confirm this fixes the test_smartcard__two_tokens_match_on_both failure in PR#8519:

Version:

[root@client ~]# rpm -q sssd
sssd-2.13.0-99.20260422110653129739.pr8629.168.g4868b17eb.fc42.x86_64

Results:

tests/test_smartcard.py::test_smartcard__two_tokens_match_on_first (ipa) PASSED
tests/test_smartcard.py::test_smartcard__two_tokens_match_on_second (ipa) PASSED
tests/test_smartcard.py::test_smartcard__two_tokens_match_on_both (ipa) PASSED
==== 3 passed, 1 deselected in 200.01s (0:03:20) ====

@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.

You can probably move the enroll_to_token() to the framework. It might be useful in other places (like the GDM tests) to consolidate and reduce duplicate code. Overall the tests look good. And with the fix in #8629, all the tests are working now.

Comment thread src/tests/system/tests/test_smartcard.py Outdated
Comment thread src/tests/system/tests/test_smartcard.py
TOKEN_PIN = "123456"


def enroll_to_token(

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.

I'm wondering now if this would be better to add this to the smartcard util in the framework with this: SSSD/sssd-test-framework#239

Also, if this is moved to the framework, can the initialize_card() be included here to make this more generic?

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.

Hi,

I see this same pattern in test_gdm.py and test_ipa.py so I agree that it makes sense to move it to the framework and I think initialize_card() can be added as well to cover the most common case. The variant in test_gdm.py even has an option to call it or not.

bye,
Sumit

@krishnavema
krishnavema marked this pull request as ready for review April 23, 2026 16:56
@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 1322416 to 44bb74a Compare April 23, 2026 17:09
@krishnavema
krishnavema requested a review from spoore1 April 23, 2026 17:17
@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 44bb74a to 9d50c98 Compare April 24, 2026 08:34
Comment thread src/tests/system/tests/test_smartcard.py Outdated
Comment thread src/tests/system/tests/test_smartcard.py Outdated
@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 9d50c98 to 401bde4 Compare April 24, 2026 15:58
@krishnavema
krishnavema requested a review from sumit-bose April 24, 2026 15:59

@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.

I think the only thing left with this one is to decide if you still need the intialize_card()'s in the setup_two_tokens() helper. I think it can be dropped now with the change in sssd-test-framework#239 right?

Comment thread src/tests/system/tests/test_smartcard.py Outdated
@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 401bde4 to 49ea146 Compare April 25, 2026 11:17

@sumit-bose sumit-bose 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.

Hi,

thank you for the updates, ACK.

Please do not forget to remove the first patch before setting 'Accepted'.

bye,
Sumit

@krishnavema
krishnavema force-pushed the smartcard-multi-token-tests branch from 49ea146 to bfcf14b Compare April 27, 2026 16:04
@spoore1

spoore1 commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Test failures unrelated:

ERROR tests/test_kcm.py::test_kcm__tgt_renewal_updates_ticket_as_configured (client) - TypeError: _FlakyPlugin._make_test_flaky() got an unexpected keyword argument 'reruns'

@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

@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @spoore1 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.

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.

5 participants