-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.04 KB
/
Issue8649.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Testing Issue 8649
on:
workflow_dispatch:
jobs:
test-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'macos-12', 'macos-13', 'macos-14']
try: ['0', '1', '2']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: python.socket (before)
shell: python
run: |
print(
'Linux: Expecting gethostname to return the same as "hostname"'
' and the other interfaces to return the same as "hostname -f"'
'\n\n'
'Mac OS: Expect *ipv6.arpa addresses due to a longstanding'
' Python bug\n\n'
)
import socket
for expr in (
'socket.gethostname()',
'socket.getfqdn()',
'socket.getfqdn(socket.gethostname())',
'socket.getfqdn(socket.getfqdn())',
'socket.gethostbyname_ex(socket.gethostname())[0]',
'socket.gethostbyname_ex(socket.getfqdn())[0]'
):
try:
result = eval(expr)
except Exception as exc:
result = str(exc)
print(f'{expr:50}: {result}')
- name: Get value of /etc/hosts
run: |
sudo cat /etc/hosts
- name: nslookup for mac
shell: bash
run: |
echo -e "Expecting nslookup to return $(hostname -f)\n\n"
for host in "$(hostname)" "$(hostname -f)"; do
echo -e "$(ipconfig getifaddr en0) $(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
dscacheutil -q host -a name $(hostname -f)
done
- name: Get value of /etc/hosts
run: |
sudo cat /etc/hosts
- name: resolve
shell: pwsh
run: |
$hostName = [System.Net.Dns]::GetHostName()
[System.Net.Dns]::GetHostEntry($hostName)
- name: Ping the hostname
run: |
set -x
hostname
ping -c 4 $(hostname) || :
- name: python.socket (after)
shell: python
run: |
print(
'Linux: Expecting gethostname to return the same as "hostname"'
' and the other interfaces to return the same as "hostname -f"'
'\n\n'
'Mac OS: Expect *ipv6.arpa addresses due to a longstanding'
' Python bug\n\n'
)
import socket
for expr in (
'socket.gethostname()',
'socket.getfqdn()',
'socket.getfqdn(socket.gethostname())',
'socket.getfqdn(socket.getfqdn())',
'socket.gethostbyname_ex(socket.gethostname())[0]',
'socket.gethostbyname_ex(socket.getfqdn())[0]'
):
try:
result = eval(expr)
except Exception as exc:
result = str(exc)
print(f'{expr:50}: {result}')