-
Notifications
You must be signed in to change notification settings - Fork 256
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
Tests: alltests/test_ldap_extra_attrs.py converted #6977
Conversation
d7eb96f
to
ee26e58
Compare
45a517e
to
f5204be
Compare
112fb2e
to
9eb98d1
Compare
I corrected my code for next round. @justin-stephenson |
9eb98d1
to
6b11d88
Compare
Okay let's wait for SSSD/sssd-test-framework#56 then re-run CI here before approving. |
Blocking PR merged, rerunning this one |
6b11d88
to
5bb1e60
Compare
@justin-stephenson CI is green. I think that failures are unrelated. Can we proceed? |
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.
Ack, thank you.
def test_ldap_extra_attrs__thread_issue(client: Client, provider: GenericProvider): | ||
""" | ||
:title: Thread issue can cause the application to not get any identity information | ||
:setup: | ||
1. Create new user "user1" | ||
2. Edit config - "use_fully_qualified_names" to "false" | ||
3. Start SSSD | ||
:steps: | ||
1. Start new thread with provided function | ||
2. Main thread waits for worker and then sleeps | ||
3. Worker is in loop calling getpwuid() | ||
4. Main thread cancel worker thread (with exit_flag.set()) | ||
5. Thread join | ||
6. Call getpwuid() | ||
:expectedresults: | ||
1. Thread is started | ||
2. Success | ||
3. Success | ||
4. Worker is cancelled | ||
5. Thread is joined | ||
6. Call is not stucked | ||
:customerscenario: True | ||
""" | ||
|
||
def worker(): | ||
nonlocal started, exit_flag | ||
uid = os.geteuid() | ||
started.set() | ||
while not exit_flag.is_set(): | ||
pwd.getpwuid(uid) | ||
|
||
provider.user("user1").add() | ||
client.sssd.domain["use_fully_qualified_names"] = "false" | ||
client.sssd.start() | ||
|
||
started = threading.Event() | ||
exit_flag = threading.Event() | ||
|
||
thread = threading.Thread(target=worker) | ||
thread.start() | ||
|
||
started.wait() | ||
time.sleep(3) | ||
|
||
exit_flag.set() | ||
thread.join() | ||
|
||
pw = pwd.getpwuid(os.geteuid()) | ||
assert pw.pw_name, "pwd.getpwuid() call did not return anything" |
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.
I don't think this tests anything.
- python threads are only simulated, they are not real threads
- all code here is executed on the localhost not on the client (both threads and getpwuid)
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.
Please, check if you can reproduce the issue if you run the python code on the client. Maybe the simulated thread is sufficient. Otherwise we will need to use a C code, which again raises a question of how do we want to handle it.
For now, you can remove this test case from this PR so it can be pushed - please, resolve conflicts. You can handle it on different pull request. |
5bb1e60
to
be4a562
Compare
I resolved the conflicts (Changed the name of the file) and removed last test. Now it is ready |
be4a562
to
6ab441a
Compare
Depends on: SSSD/sssd-test-framework#56