openwisp / openwisp/docker-openwisp
[bug] Local unit tests fail: missing `/etc/hosts` configuration on Linux machines
Nobody has claimed this yet.
- 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:
- Clone the repository and set up the local environment
- Run the tests:
make runtests - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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