dredd: Error connecting to server under test when server on localhost
Describe your problem
Each test is failing with the following error:
error: Error connecting to server under test!
Despite the api endpoint is set to http://localhost:8000 , the api calls are sent to http://127.0.0.1:8000.
Running a web server on 127.0.0.1 instead of localhost solves the problem.
What command line options do you use?
$ dredd
What is in your dredd.yml?
reporter: apiary
custom:
apiaryApiKey: *******
apiaryApiName: ********
dry-run: null
hookfiles: './hooks.php'
language: 'bin/dredd-hooks-php'
sandbox: false
server:
server-wait: 3
init: false
names: false
only: []
output: []
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
level: info
timestamp: false
silent: false
path: []
hooks-worker-timeout: 5000
hooks-worker-connect-timeout: 1500
hooks-worker-connect-retry: 500
hooks-worker-after-connect-wait: 100
hooks-worker-term-timeout: 5000
hooks-worker-term-retry: 500
hooks-worker-handler-host: localhost
hooks-worker-handler-port: 61321
config: ./dredd.yml
blueprint: api.apib
endpoint: 'http://localhost:8000/api/v1'
What’s your dredd --version output?
dredd v2.2.5 (Darwin 15.6.0; x64)
Does dredd --level=debug uncover something?
debug: Evaluating results of transaction execution #1: Authorisation > Logout > Logout
debug: No emission of test data to reporters { Error: connect ECONNREFUSED 127.0.0.1:8000
at Object.exports._errnoException (util.js:1028:11)
at exports._exceptionWithHostPort (util.js:1051:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8000 }
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (10 by maintainers)
Commits related to this issue
- refactor: Use 127.0.0.1 instead of localhost Using 'localhost' can provably cause problems on Windows in some cases. Replacing 'localhost' with '127.0.0.1' avoids these problems. The change is made e... — committed to apiaryio/dredd by honzajavorek 7 years ago
- feat: Use 127.0.0.1 instead of localhost Using 'localhost' can provably cause problems on Windows in some cases. Replacing 'localhost' with '127.0.0.1' avoids these problems. The change is made every... — committed to apiaryio/dredd by honzajavorek 7 years ago
- feat: Use 127.0.0.1 instead of localhost Using 'localhost' can provably cause problems on Windows in some cases. Replacing 'localhost' with '127.0.0.1' avoids these problems. The change is made every... — committed to apiaryio/dredd by honzajavorek 7 years ago
@honzajavorek it actually DOES work when I start a php server on
127.0.0.1instead oflocalhost.the problem is that despite the api endpoint is set to
http://localhost:8000, the api calls are sent tohttp://127.0.0.1:8000.Same problem here! I use
server: 'php -S 127.0.0.1:3000 -t public'In the context of server location it is
protocol://hostname, eg.https://example.com/. Add a protocol (I presume you are usinghttp, sohttp://xxxxxxx.xxxxxxx-xx.eu-west-1.amazonaws.com) and it will be valid server location.@Pablodotnet @karpilin So you say this is not related to
127.0.0.1vs.localhostrouting? The127.0.0.1doesn’t work as well? 😞