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

macos-latest lacking localhost #6383

Closed
2 of 11 tasks
bje- opened this issue Oct 10, 2022 · 3 comments
Closed
2 of 11 tasks

macos-latest lacking localhost #6383

bje- opened this issue Oct 10, 2022 · 3 comments
Assignees
Labels
bug report documentation Improvements or additions to documentation OS: macOS question Further information is requested

Comments

@bje-
Copy link

bje- commented Oct 10, 2022

Description

The macos-latest runner was failing on some Python tests I had written that made use of a simple TCP client and server. To confirm my suspicions, I added a host localhost command to one of my install dependencies step and sure enough I got:

Host localhost not found: 3(NXDOMAIN)

Why doesn't the runner have an /etc/hosts or similar entry for localhost?

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • macOS 10.15
  • macOS 11
  • macOS 12
  • Windows Server 2019
  • Windows Server 2022

Image version and build link

Image: macos-11
Version: 20221002.2

Is it regression?

Unsure

Expected behavior

I expect localhost to be defined as it is on ubuntu-latest.

Actual behavior

localhost is not found, so tests that refer to this hostname fail.

Repro steps

Create a build script that runs host localhost to reproduce.

@al-cheb al-cheb added documentation Improvements or additions to documentation question Further information is requested OS: macOS and removed needs triage labels Oct 10, 2022
@al-cheb
Copy link
Contributor

al-cheb commented Oct 10, 2022

Hey @bje-.
This is by design. The host command uses standard C library calls to contact the DNS resolvers directory; it does not use mDNSResponder or DirectoryService(bypass the system name resolver, and query DNS directly, it won't resolve names defined in /etc/hosts (unless they're also defined in the DNS service)).

To resolve ip address for host entry in /etc/hosts, you should use dscacheutil -q host -a name localhost command:
image

The default DNS on macOS is set to 8.8.8.8 without localhost defined entries in it. But for test purposes you could use - 9.9.9.9:

 - run: host localhost || true
 - run: sudo networksetup -setdnsservers Ethernet 9.9.9.9
 - run: host localhost

image

@al-cheb al-cheb closed this as completed Oct 10, 2022
@al-cheb al-cheb self-assigned this Oct 10, 2022
@bje-
Copy link
Author

bje- commented Oct 11, 2022

OK, my choice of using host to demonstrate the problem was not the greatest idea. I'm simply trying to illustrate that localhost is not a recognised hostname for applications being tested on the macos-latest runner. It doesn't strike me as unusual to expect it to be.

I'll use your workaround for now. Thanks.

@lastmjs
Copy link

lastmjs commented Feb 1, 2024

Can we get this issue fixed? It seems strange that localhost simply doesn't work on MacOS. I have test code that is identical running on Ubuntu runners, and switching to MacOS runners are tests simply started failing in a very confusing way.

michaelbromley added a commit to vendure-ecommerce/vendure that referenced this issue Apr 4, 2024
Some issue is preventing the verdaccio install
from working. Could be related to
actions/runner-images#6383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report documentation Improvements or additions to documentation OS: macOS question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants