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

[testing] autopkgtests failure for report_disabled_parsers.py:ReportDisabledParsersTest.test_local_ip_not_obfuscated #3975

Open
arif-ali opened this issue Mar 26, 2025 · 1 comment · May be fixed by #3981
Assignees
Labels
Kind/Testing Related to Testing Kind/Ubuntu Ubuntu related item
Milestone

Comments

@arif-ali
Copy link
Member

In preparation of avocado landing in Debian and Ubuntu (which is due to land in a week or so), I have been doing some tests in our test environments, and we get the following issue

(007/276) tests/cleaner_tests/report_disabled_parsers.py:ReportDisabledParsersTest.test_local_ip_not_obfuscated:  FAIL: Content '127.0.1.1' does not appear in /var/tmp/avocado_4k2ol_orsos_tests.py.ReportDisabledParsersTest/sosreport-ReportDisabledParsersTest/sosreport-host0-2025-03-24-vlozhxk/ip_addr\n1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferre... (13.42 s)

This issue has been created to track the issue so that it's not lost, and will form a fix soon.

Full Logs: https://autopkgtest.ubuntu.com/results/autopkgtest-plucky-arif-ali-sos-avocado/plucky/amd64/s/sos/20250324_192636_f5814@/log.gz#S5

@arif-ali arif-ali added Kind/Ubuntu Ubuntu related item Kind/Testing Related to Testing labels Mar 26, 2025
@arif-ali arif-ali added this to the 4.9.1 milestone Mar 26, 2025
@arif-ali arif-ali self-assigned this Mar 26, 2025
@arif-ali
Copy link
Member Author

arif-ali commented Apr 3, 2025

So, I've figured this out

When creating new instances we have the following whether it's rocky, or ubuntu

Hosts file

[root@rocky9-01 ~]# cat /etc/hosts
127.0.1.1	rocky9-01
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Use the pythonic way to get IP

[root@rocky9-01 ~]# python3
Python 3.9.21 (main, Dec  5 2024, 00:00:00) 
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print(socket.gethostbyname("rocky9-01"))
127.0.1.1

Check the current ip addresses

[root@rocky9-01 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:16:3e:64:77:58 brd ff:ff:ff:ff:ff:ff
    inet 10.201.177.69/24 brd 10.201.177.255 scope global dynamic noprefixroute enp5s0
       valid_lft 2514sec preferred_lft 2514sec
    inet6 fe80::216:3eff:fe64:7758/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

So based on the above, the test would fail

arif-ali added a commit to arif-ali/sos that referenced this issue Apr 3, 2025
Running stageone tests in some environments sees the hostname of the
machine to have an IP of 127.0.1.1 but the host is never set up in a
way that this address is configured on the host. So if 127.0.1.1 is the
one being detected, then ignore the test.

Closes: sosreport#3975
Signed-off-by: Arif Ali <[email protected]>
@arif-ali arif-ali linked a pull request Apr 3, 2025 that will close this issue
6 tasks
arif-ali added a commit to arif-ali/sos that referenced this issue Apr 4, 2025
Running stageone tests in some environments sees the hostname of the
machine to have an IP of 127.0.1.1 but the host is never set up in a
way that this address is configured on the host. We check for
hostname.local, which ensures we get the address of the host rather
than the alternative of 127.0.1.1.

Closes: sosreport#3975
Signed-off-by: Arif Ali <[email protected]>
arif-ali added a commit to arif-ali/sos that referenced this issue Apr 4, 2025
Running stageone tests in some environments sees the hostname of the
machine to have an IP of 127.0.1.1 but the host is never set up in a
way that this address is configured on the host. We check for
hostname, if this returns a loopback address then we add .local to
the end of the hostname, which ensures we get the address of the host.

Closes: sosreport#3975
Signed-off-by: Arif Ali <[email protected]>
arif-ali added a commit to arif-ali/sos that referenced this issue Apr 8, 2025
Running stageone tests in some environments sees the hostname of the
machine to have an IP of 127.0.1.1 but the host is never set up in a
way that this address is configured on the host. We use socket.connect
to connect to a dummy address, which ensure to go via a default route
and therefore not track the loopbak address. Then grabbing the IP of
the socket give you a proper local IP address.

Closes: sosreport#3975
Signed-off-by: Arif Ali <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind/Testing Related to Testing Kind/Ubuntu Ubuntu related item
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant