Skip to content

[bug] Local unit tests fail: missing /etc/hosts configuration on Linux machines #614

Description

@CodingWithSaksham

Describe the bug
Unit tests fail with DNS resolution errors when run locally with make runtests. The test suite attempts to connect to dashboard.openwisp.org and api.openwisp.org, but these hostnames are not resolvable on the developer's machine, causing Selenium WebDriver and HTTP requests to fail with net::ERR_NAME_NOT_RESOLVED and [Errno -2] Name or service not known errors.

The services are actually running and accessible (nginx is listening on 127.0.0.1:443), but the hostname resolution is missing from the local /etc/hosts file. The CI pipeline works because it explicitly adds these entries during test setup, but the local make runtests workflow does not.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Clone the repository and set up the local environment
  2. Run the tests: make runtests
  3. Observe 10 out of 12 tests failing with DNS resolution errors

Expected behavior
All unit tests should pass, or at minimum provide clear guidance on required setup steps (like adding /etc/hosts entries).

Screenshots
N/A

System Information:

  • OS: Fedora 42
  • Docker version: 29.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions