openwisp / openwisp/docker-openwisp

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

Open
#614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
209
Forks
125
Avg merge
1d 4h
Merged PRs (30d)
24

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the make runtests target and compare its setup with the CI pipeline, especially where /etc/hosts entries are added. Reproduce the DNS failures locally, then verify that the local test workflow either performs the required hostname setup or clearly explains it, and rerun the unit tests to confirm they pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx, python
Domain
devops, networking, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.