SatelliteQE / robottelo

Robottelo is a test suite that exercises The Foreman.
GNU General Public License v3.0
61 stars 114 forks source link

[6.15.z] Fix test_positive_mismatched_satellite_fqdn #16863

Closed Satellite-QE closed 3 weeks ago

Satellite-QE commented 3 weeks ago

Cherrypick of PR: https://github.com/SatelliteQE/robottelo/pull/16796

Test seemed to randomly fail on assertion at https://github.com/SatelliteQE/robottelo/blob/952b960381ce5817ffdd5598c3d9fc4ef8b9fff0/tests/foreman/destructive/test_installer.py#L109

After some investigation I found out that the domain is being generated randomly and for some domains (e.g. test.com, test.biz) the output of hostname --fqdn returns FQDN, not just "shortname" as we expected.

Removing nameservers from /etc/resolv.conf solves the issue.

> hostnamectl set-hostname testname # set test hostname
> echo "search example.info" > /etc/resolv.conf # set search domain to example.info
> hostname --fqdn # hostname prints only hostname without domain name
testname
> sed -i "s/^search.*/search test.biz/" /etc/resolv.conf # set search domain to test.biz
> hostname --fqdn # for some reason the fqdn is printed
testname.test.biz
> sed -i "/nameserver.*/d" /etc/resolv.conf # remove nameservers
> hostname --fqdn # only hostname without domain name is printed
testname
Satellite-QE commented 3 weeks ago

trigger: test-robottelo pytest: tests/foreman/destructive/test_installer.py -k test_positive_mismatched_satellite_fqdn

Satellite-QE commented 3 weeks ago

PRT Result

Build Number: 9235
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/destructive/test_installer.py -k test_positive_mismatched_satellite_fqdn --external-logging
Test Result : ========== 1 passed, 4 deselected, 17 warnings in 1107.53s (0:18:27) ===========