-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dredd keeps failing to connect to hooks handler #26
Comments
Just to rule out the possibility you have dredd-hooks-php installed via composer and it's in the |
Yep, it is. |
When I add $ node_modules/.bin/dredd apiary.apib http://localhost:8001 --server "php -S 0.0.0.0:8001 -t public/" --language vendor/bin/dredd-hooks-php --hookfiles tests/dredd/hooks/hookfile.php --hooks-worker-handler-port 8001
info: Starting backend server process with command: php -S 0.0.0.0:8001 -t public/
info: Waiting 3 seconds for backend server process to start.
[Sat Jan 21 08:16:43 2017] Failed to listen on 0.0.0.0:8001 (reason: Address already in use)
info: Backend server process exited.
info: Beginning Dredd testing...
info: Found Hookfiles: 0=tests/dredd/hooks/hookfile.php
info: Spawning `vendor/bin/dredd-hooks-php` hooks handler process.
info: Successfully connected to hooks handler. Waiting 0.1s to start testing.
info: Hooks handler stdout: Starting server
warn: Hook handling timed out.
warn: Hook handling timed out.
warn: Hook handling timed out.
fail: GET /icons duration: 5013ms
warn: Hook handling timed out.
info: Sending SIGTERM to hooks handler process.
info: Displaying failed tests...
fail: GET /icons duration: 5013ms
fail: Failed in before hook: Hook timed out.
complete: 0 passing, 1 failing, 0 errors, 0 skipped, 1 total
complete: Tests took 21169ms
info: Sending SIGTERM to backend server process. I added a logger inside the |
Is this your first time using it? Might be helpful to run through the example in the wiki if you haven't already. Also the |
I'm closing this for now. I don't mind helping you through this until you get it working but this is a user issue and not something that needs fixed. |
Yes it is. I've run through multiple examples from the wiki and some blog posts. When I use error: PHP hooks handler command not found: dredd-hooks-php
Install php hooks handler by running:
$ composer require ddelnano/dredd-hooks-php --dev No problem for closing the issue. Was just desperate for some help. Thanks for helping :) |
Managed to solve the
Still can't connect to the handler though 😕 |
Is this a project that can be shared so I can take a look and poke around things? |
@ddelnano unfortunately not :( it's a closed source project. I can provide as many code snippets within reason if you want. |
I just tried setting up a vanilla Laravel project to try out Dredd but now I'm getting the following issue. It's a different one from above but it's weird that I can't even get the most basic setup to work 😕 $ dredd apiary.apib http://localhost:3000 --server "nohup php -S localhost:3000 -t public &>/dev/null"
info: Starting backend server process with command: nohup php -S localhost:3000 -t public &>/dev/null
info: Waiting 3 seconds for backend server process to start.
info: Beginning Dredd testing...
error: GET /posts duration: 16ms
error: Error connecting to server under test!
info: Displaying failed tests...
fail: GET /posts duration: 16ms
fail: Error connecting to server under test!
request:
method: GET
uri: /posts
headers:
User-Agent: Dredd/2.2.5 (Darwin 16.3.0; x64)
body:
expected:
headers:
Content-Type: application/json
body:
[
{
"id": 1,
"title": "Hello World"
}
]
statusCode: 200
complete: 0 passing, 0 failing, 1 errors, 0 skipped, 1 total
complete: Tests took 24ms
info: Sending SIGTERM to backend server process.
info: Backend server process was killed. |
Why do you run the server using |
Heya, I'm using |
So given you were getting @driesvints also what version of the php hooks are you using? |
Heya, I can trigger an
I cannot seem to re-trigger the |
@ddelnano Using the latest 1.1.5 version of this package. |
@driesvints the hook handler is what I am interested in and is what Dredd is having trouble connecting to. Basically I want to verify that you are able to connect to the hook server and rule out that the server is not functioning properly. Can you try to do what I described above with netcat? |
@ddelnano ah yeah sorry. I actually tried it out but forgot to paste the result. I can't connect to it:
|
Btw @honzajavorek if you want me to open a separate issue for the second issue let me know. |
@driesvints can you try launching the server yourself and running the same test? If the following works than something is going on with how Dredd is launching the server potentially
|
@ddelnano getting the same result |
Btw, I'm really sorry for not mentioning this earlier but I wasn't sure if it mattered: I'm running this on a Vagrant box and not on my local machine. Using Ubuntu Trusty:
|
Hmm, when I use
|
@driesvints ah does your vagrant box not have
|
I think so. When I also change
I indeed just discovered that the Investigating further because after running it again it seems that the hooks are finally working. Although I still have no clue why the error above keeps happening. |
There is a previous hooks server listening on the port. Do the following. Dredd is supposed to clean those up but I am guessing since you are seeing some weird issues here maybe it did not get killed.
Then rerun your dredd command. |
@ddelnano ok so now I'm getting the following. Doing the following steps:
Result for the first run: $ node_modules/.bin/dredd apiary.apib http://127.0.0.1:3000/api --server "nohup php -S 127.0.0.1:3000 -t public/ &>/dev/null" --language vendor/bin/dredd-hooks-php --hookfiles tests/dredd/hooks/hookfile.php --hooks-worker-handler-host 127.0.0.1
info: Starting backend server process with command: nohup php -S 127.0.0.1:3000 -t public/ &>/dev/null
info: Waiting 3 seconds for backend server process to start.
info: Beginning Dredd testing...
info: Found Hookfiles: 0=tests/dredd/hooks/hookfile.php
info: Spawning `vendor/bin/dredd-hooks-php` hooks handler process.
warn: Error connecting to the hooks handler process. Is the handler running? Retrying.
info: Hooks handler stdout: Starting server
error: Connection timeout 1.5s to hooks handler on 127.0.0.1:61321 exceeded. Try increasing the limit.
info: Sending SIGTERM to backend server process.
info: Backend server process was killed. Result for the second run:
The second try successfully made the connection and I suspect it fails because I still need to configure the setup in the hooks file properly. I get the following result in the
The |
@ddelnano I did try to command you gave but it didn't give any result. |
Success! I managed to get the tests passing and the hooks working. The
|
you have a hooks server or something else bound to that port somehow. hm maybe I typed that command out wrong but it should have worked. You can also pass the |
I got a bit lost in the discussion, but sure 😄 |
@ddelnano how do you pass the Also: how would you handle passing environment variables to the command? Just set them before the command? Btw, really appreciate all the help! |
@ddelnano I rebooted the Vagrant machine to make sure all connections were closed and that did the trick. I also increased the hooks connect timeout to 3s and that also made sure that the worker could connect properly. I don't get the
|
@driesvints either in your dredd.yml or you can probably add it in the language flag directly but you will need to add quotes around the |
Never tried before so I am not sure about the environment variables. |
@ddelnano I ended up using Think I'm all set now. It's working both locally and on CircleCI. Thanks for all your help. And thanks for being so patient with me ^^ |
No worries glad you're setup |
@honzajavorek heya, I managed to solve the second problem by recreating the project from scratch. There must have been some hiccup in the first attempt. Anyway, it's all working now. Thanks for your help :) |
Good, you're welcome! Enjoy Dredd! |
Ok so, I've been pulling my hair out on this one. I keep getting the message below and have no clue what's going wrong. Tried increasing timeouts etc but I don't think that's the problem. Could it perhaps be file permissions related?
Here's the CLI output:
Here's the basic
hookfile.php
Does anyone have an idea what I'm missing or what I might be doing wrong? Running PHP 5.5 with Laravel 5.2 for this specific project.
The text was updated successfully, but these errors were encountered: