Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions src/tests/system/tests/test_failover.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,55 @@

import pytest
from sssd_test_framework.roles.client import Client
from sssd_test_framework.roles.ldap import LDAP
from sssd_test_framework.topology import KnownTopology
from sssd_test_framework.roles.generic import GenericProvider
from sssd_test_framework.topology import KnownTopology, KnownTopologyGroup

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'KnownTopology' is not used.
Copy link
Contributor

Choose a reason for hiding this comment

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

@danlavu , please remove unused import.



@pytest.mark.parametrize("value, expected", [(None, 31), (15, 31), (60, 60)])
@pytest.mark.importance("low")
@pytest.mark.ticket(gh=7375, jira="RHEL-17659")
@pytest.mark.topology(KnownTopology.LDAP)
def test_failover__retry_primary(client: Client, ldap: LDAP, value: int | None, expected: int):
@pytest.mark.topology(KnownTopologyGroup.AnyProvider)
def test_failover__reactivation_timeout_is_honored(
client: Client, provider: GenericProvider, value: int | None, expected: int
):
"""
:title: Primary server reactivation timeout is respected
:title: Primary server reactivation timeout is honored
:setup:
1. Create LDAP user "user-1"
1. Create user "user-1"
2. Set failover_primary_timeout to @value
3. Set ldap_uri to invalid, not working server
4. Set ldap_backup_uri to working server
3. Set server/URI to an invalid server
4. Set backup server/URI to the server
5. Start SSSD
:steps:
1. Lookup user-1
2. Check that SSSD is connected to backup server
2. Check that SSSD is connected to the backup server
3. Find "Primary server reactivation timeout set to @expected seconds" in domain logs
:expectedresults:
1. SSSD failover to backup server
2. SSSD is indeed connected to the backup server
1. User is found
2. SSSD is connected to the backup server
3. String is found
:customerscenario: True
"""
ldap.user("user-1").add()
provider.user("user-1").add()

if value is not None:
client.sssd.domain["failover_primary_timeout"] = str(value)

client.sssd.set_invalid_primary_server(provider)
client.sssd.enable_responder("ifp")
client.sssd.domain["ldap_uri"] = "ldap://ldap.invalid"
client.sssd.domain["ldap_backup_uri"] = f"ldap://{ldap.host.hostname}"
client.sssd.start()

# Lookup user to make sure SSSD did correctly failover to backup server
# Lookup user to make sure SSSD did correctly failover to the backup server
result = client.tools.id("user-1")
assert result is not None
assert result is not None, "User is not found!"

# Check that SSSD is indeed connected to backup server
assert client.sssd.default_domain is not None
# Check that SSSD is indeed connected to the backup server
assert client.sssd.default_domain is not None, "Default domain is not set!"
status = client.sssctl.domain_status(client.sssd.default_domain, active=True)
assert ldap.host.hostname in status.stdout
assert provider.host.hostname in status.stdout, f"{provider.host.hostname} is not found in domain status!"

# Check that primary server reactivation timeout was correctly created
log = client.fs.read(client.sssd.logs.domain())
assert f"Primary server reactivation timeout set to {expected} seconds" in log
assert (
f"Primary server reactivation timeout set to {expected} seconds" in log
), f"'Primary server reactivation timeout set to {expected} seconds' not found in logs!"

Loading