ovh / venom

🐍 Manage and run your integration tests with efficiency - Venom run executors (script, HTTP Request, web, imap, etc... ) and assertions
Apache License 2.0
1.06k stars 144 forks source link

Venom does not resolve DNS names like "curl" #816

Open arikkfir opened 2 months ago

arikkfir commented 2 months ago

Overview

Seems DNS resolution on a macOS M2 Pro 2023 works differently than other apps (e.g. curl). This happens where there's a local dnsmasq and the macOS is configured to defer to it for a specific domain.

Other apps such as curl work with this setup implicitly - not sure why venom fails to pick up this configuration.

Reproduce

Setup

Setup the local dnsmasq and macOS-to-dnsmasq configuration (assuming greenstar.local is the bogus domain that only works locally):

brew install -q dnsmasq
echo "conf-dir=/opt/homebrew/etc/dnsmasq.d/,*.conf" >> "/opt/homebrew/etc/dnsmasq.conf"
echo "address=/.greenstar.local/127.0.0.1" > "/opt/homebrew/etc/dnsmasq.d/greenstar.local.conf"
sudo "/opt/homebrew/bin/brew" services restart dnsmasq
sudo mkdir -p "/etc/resolver"
sudo bash -c "echo \"nameserver 127.0.0.1\" > /etc/resolver/greenstar.local"
mkdir -p ./hack

Reproducing it

#### Simple venom test:
$ cat test.yaml
name: Tenants
description: |-
  Test the /tenants API
testcases:
  - name: Tenant creation
    steps:
      - type: http
        method: POST
        url: https://api.greenstar.local/tenants
        timeout: 5
        assertions:
          - result.statuscode ShouldEqual 200

#### Running venom:
$ venom run ./backend/e2e/venom.yaml
      [trac] writing venom.1.log
 • Tenants (./backend/e2e/venom.yaml)
    • Tenant-creation FAIL
Testcase "Tenant creation", step #0-0: Post "https://api.greenstar.local/tenants": dial tcp: lookup api.greenstar.local on 1.1.1.1:53: no such host (venom.yaml:0)
final status: FAIL

#### Proving that curl does work without any special configuration or flags:
$ curl -i https://api.greenstar.local/
HTTP/2 401
cache-control: no-store, no-cache, must-revalidate, max-age=0
content-type: text/plain; charset=utf-8
date: Mon, 16 Sep 2024 10:52:00 GMT
expires: 0
pragma: no-cache
vary: Origin
x-content-type-options: nosniff
x-request-id: 9e6b6ba8-4c8d-4a56-813a-3aaf8d336566
content-length: 13

Unauthorized

Any idea why Venom fails on its DNS resolution, but curl does not?