Skip to content

Paged results test sets hostname to localhost on test collection #6052

Closed
@vashirov

Description

@vashirov

Issue Description
Paged results test module has some code outside of the test functions and fixtures:

OLD_HOSTNAME = socket.gethostname()
if os.getuid() == 0:
socket.sethostname('localhost')
HOSTNAME = socket.gethostname()
IP_ADDRESS = socket.gethostbyname(HOSTNAME)
OLD_IP_ADDRESS = socket.gethostbyname(OLD_HOSTNAME)

It gets interpreted by pytest on test collection. These tests might be even skipped, but the code to change the hostname would still be executed. This leads to a situation, where certain test cases fail with:

E         ldap.SERVER_DOWN: {'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': [], 'info': 'TLS: hostname does not match subjectAltName in peer certificate'}

Code like this should be in a fixture. But in this case I don't think we need to change the hostname at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThe issue will be triaged during scrum

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions