Skip to content

Commit

Permalink
Issue 5415 - Hostname when set to localhost causing failures in other…
Browse files Browse the repository at this point in the history
… tests

Description: When the hostname is set to localhost it is causing failures
in other test suites like replication

Fixes: #5415

Reviewed by: @bsimonova, @tbordaz (Thanks!)
  • Loading branch information
aadhikar authored and bsimonova committed Aug 11, 2022
1 parent 59fe6dc commit 3cda974
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dirsrvtests/tests/suites/acl/keywords_part2_test.py
Expand Up @@ -20,6 +20,7 @@
from lib389.idm.domain import Domain
from lib389.idm.organizationalunit import OrganizationalUnit
from lib389.idm.user import UserAccount
from lib389.utils import *

pytestmark = pytest.mark.tier1

Expand All @@ -39,7 +40,7 @@
NOWORKER_KEY = "uid=NOWORKER_KEY,{}".format(TIMEOFDAY_OU_KEY)


def test_access_from_certain_network_only_ip(topo, add_user, aci_of_user):
def test_access_from_certain_network_only_ip(topo, add_user, aci_of_user, request):
"""
User can access the data when connecting from certain network only as per the ACI.
Expand Down Expand Up @@ -95,8 +96,14 @@ def test_access_from_certain_network_only_ip(topo, add_user, aci_of_user):
with pytest.raises(ldap.INSUFFICIENT_ACCESS):
org.replace("seeAlso", "cn=1")

def fin():
log.info('Setting the hostname back to orginal')
socket.sethostname(old_hostname)

def test_connection_from_an_unauthorized_network(topo, add_user, aci_of_user):
request.addfinalizer(fin)


def test_connection_from_an_unauthorized_network(topo, add_user, aci_of_user, request):
"""
User cannot access the data when connectin from an unauthorized network as per the ACI.
Expand Down Expand Up @@ -145,6 +152,12 @@ def test_connection_from_an_unauthorized_network(topo, add_user, aci_of_user):
# now user can access data
org.replace("seeAlso", "cn=1")

def fin():
log.info('Setting the hostname back to orginal')
socket.sethostname(old_hostname)

request.addfinalizer(fin)


def test_ip_keyword_test_noip_cannot(topo, add_user, aci_of_user):
"""
Expand Down
Expand Up @@ -72,6 +72,7 @@ def create_user(topology_st, request):
def fin():
log.info('Deleting user simplepaged_test')
user.delete()
socket.sethostname(OLD_HOSTNAME)

request.addfinalizer(fin)

Expand Down

0 comments on commit 3cda974

Please sign in to comment.