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

Tests: Add support for IPA IPA Trust #7517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

justin-stephenson
Copy link
Contributor

Add tests for new IPA Trust topologies in SSSD test framework.

Linked PRs:

SSSD/sssd-ci-containers#106
SSSD/sssd-test-framework#119

src/tests/system/tests/test_ipa_trusts.py Outdated Show resolved Hide resolved
src/tests/system/tests/test_ipa_trusts.py Outdated Show resolved Hide resolved
@pbrezina
Copy link
Member

Hi, I added blocked label since I think we should not merge it until new IPA is released. We should also add conditional skip based on feature detection.

@justin-stephenson
Copy link
Contributor Author

Updated mhc.yaml based on SSSD/sssd-test-framework#119 (comment)

Copy link

@danlavu danlavu left a comment

Choose a reason for hiding this comment

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

Passing,

============================= test session starts ==============================
collecting ... 

Selected tests will use the following hosts:
  client: client.test
  ad: dc.ad.test
  samba: dc.samba.test
  ipa: master.ipa.test
  ipa: master2.ipa2.test

collected 586 items / 580 deselected / 6 selected

tests/test_ipa_trusts.py::test_ipa_trusts__lookup_group_without_sid (ipa-trust-ad) 
tests/test_ipa_trusts.py::test_ipa_trusts__ipa_master_lookup_trusted_user (ipa-trust-ad) 
tests/test_ipa_trusts.py::test_ipa_trusts__ipa_master_lookup_trusted_user (ipa-trust-ipa) 
tests/test_ipa_trusts.py::test_ipa_trusts__lookup_trusted_user (ipa-trust-ipa) 
tests/test_ipa_trusts.py::test_ipa_trusts__lookup_group_without_sid (ipa-trust-samba) 
tests/test_ipa_trusts.py::test_ipa_trusts__ipa_master_lookup_trusted_user (ipa-trust-samba) PASSED [ 16%]PASSED [ 33%]PASSED [ 50%]PASSED [ 66%]PASSED [ 83%]PASSED [100%]

================ 6 passed, 580 deselected in 574.83s (0:09:34) =================

Process finished with exit code 0

Some minor changes but it looks good, thank you Justin

:customerscenario: True
"""
client.sssd.clear(db=True, memcache=True, logs=True)
client.sssd.restart()
Copy link

Choose a reason for hiding this comment

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

We have updated the method, you can merge 105-106 with client.sssd.restart(clean=True) , applies to line 79-80 as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

username = trusted.admin_fqn

id_user = client.tools.id(username)
assert id_user is not None
Copy link

Choose a reason for hiding this comment

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

Can you provide an error message please, assert id_user is not None, "User is not found!"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


id_user = client.tools.id(username)
assert id_user is not None
assert id_user.user.name == username
Copy link

Choose a reason for hiding this comment

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

Same, Username does not match!

All the assertions, line, 86,87,119 and 120

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

config:
client:
ipa_domain: ipa2.test
krb5_keytab: /enrollment/ipa2.test.keytab
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 most probably wrong as there is no code to enroll client to ipa2 in SSSD/sssd-ci-containers#106

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if we plan to add any enrollment of systems into IPA2 domain. If not, can this whole part be removed?

    config:
      client:
        ipa_domain: ipa2.test
        krb5_keytab: /enrollment/ipa2.test.keytab
        ldap_krb5_keytab: /enrollment/ipa2.test.keytab

Copy link

Choose a reason for hiding this comment

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

No, I don't think we need to enroll tests into ipa2.

@@ -60,3 +61,58 @@ def test_ipa_trusts__lookup_group_without_sid(ipa: IPA, trusted: GenericADProvid
status = ipa.sssctl.domain_status(trusted.domain, online=True)
assert "online status: offline" not in status.stdout.lower(), "AD domain went offline!"
assert "online status: online" in status.stdout.lower(), "AD domain was not online!"


@pytest.mark.importance("low")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have at least on test that will cover ipa-ipa trust feature that is high or critical to land in the gating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to ask @danlavu to take care of this.

Copy link

Choose a reason for hiding this comment

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

I'm writing a test for ipa - adtrust, we should be able to parameterize it. https://github.com/SSSD/sssd/pull/7779/files , basic auth.

"""
:title: Basic IPA-IPA Trust lookup on IPA server
:setup:
1. Restart SSSD and clear cache on IPA server
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests should have requirement matching the RHEL-XXX jira name to link the test to requirement that will be created in polarion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added @pytest.mark.ticket(jira="RHEL-14752") to the 2 newly added tests.



@pytest.mark.importance("low")
@pytest.mark.topology(KnownTopologyGroup.AnyIPATrust)
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a pytest.ticket linking to relevant jiras.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added @pytest.mark.ticket(jira="RHEL-14752") to the 2 newly added tests.

assert id_user.user.name == username, "Username does not match"


@pytest.mark.importance("low")
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like importance medium to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

# Resolve group
groupname = trusted.fqn("admins")

getent_group = client.tools.getent.group(groupname)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move this before all of the asserts so we can see if group resolution works when something fails for user resolution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.


getent_group = client.tools.getent.group(groupname)
assert getent_group is not None
assert getent_group.name == groupname
Copy link
Contributor

@jakub-vavra-cz jakub-vavra-cz Dec 18, 2024

Choose a reason for hiding this comment

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

I am missing a testcase that will authenticate (su, ssh) as a normal user from the trusted domain.
(possibly parametrized for short username and fqn.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to ask @danlavu to take care of this.


id_user = client.tools.id(username)
assert id_user is not None, "Trusted admin user not found"
assert id_user.user.name == username, "Username does not match"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should check group membership for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@jakub-vavra-cz jakub-vavra-cz left a comment

Choose a reason for hiding this comment

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

See inline.

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