codeforequity-at / botium-bindings

The Selenium for Chatbots
http://www.botium.at
MIT License
108 stars 33 forks source link

No Mock Online error #102

Open 7ML0 opened 6 years ago

7ML0 commented 6 years ago

Hi,

I am trying to run some tests on a facebook bot using the docker container mode. I've had no issues with the sample, i've got docker-compose and everything else. I am following the set up provided in the sample. When I try to run my tests, it detects them but they all fail - jasmine times out because of a 'No Mock Online' error (in testmybot/node_modules/botium-core/src/containers/DockerContainer.js:424:16).

I've ran the tests in debug mode for botium and testmybot, here is the no mock online bit: botium-TcpPortUtils WaitForPort port usage (127.0.0.1:46300): true +1ms botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +0ms botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s (node:83268) UnhandledPromiseRejectionWarning: Error: No Mock online at UserSays.Promise (/Users/username/dev/repo/node_modules/testmybot/node_modules/botium-core/src/containers/DockerContainer.js:424:16) at new Promise (<anonymous>) at DockerContainer.UserSays (/Users/username/dev/repo/node_modules/testmybot/node_modules/botium-core/src/containers/DockerContainer.js:409:12) at DockerContainer.UserSaysText (/Users/username/dev/repo/node_modules/testmybot/node_modules/botium-core/src/containers/BaseContainer.js:53:17) at TestMyBot.hears (/Users/username/dev/repo/node_modules/testmybot/src/testmybot.js:119:31) at UserContext.<anonymous> (/Users/username/dev/repo/spec/testmybot.spec.js:26:9) at attempt (/Users/username/dev/repo/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4486:26) at QueueRunner.run (/Users/username/dev/repo/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4402:20) at runNext (/Users/username/dev/repo/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4446:20) at /Users/username/dev/repo/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4453:13 (node:83268) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:83268) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s

I am unsure whether this is a configuration problem on my end or not. The facebook webhook port and path that I am giving in the testmybot.json are the ones my fb page is subscribed to, and I am using ngrok to create that tunnel. The app is not published to facebook yet, so only users marked as testers can access it. Other thing to note is that I am making calls to IBM Watson API in the orchestration to process the user inputs. Any help would be much appreciated :)

codeforequity-at commented 6 years ago

Your setup seems strange - when using Botium in "docker" mode, then ngrok is not required - Botium embeds your bot into a sandbox Docker network. As you are using Watson, I would recommend to use Botiums specialized Watson connector.

7ML0 commented 6 years ago

I get testmybot to run correctly with the watson connector and it works, but I have a lot of responses triggered in my code which sit outside the Watson workspace, hence why i was looking at another connector to use which would hit my backend api if that makes sense. yes the ngrok bit was me being confused about what to pass to the FACEBOOK_WEBHOOK_PATH but have that set up correctly now, ignore that. I am passing "webhook" which is correct for my set up, and the problem remains the same.

codeforequity-at commented 6 years ago
  1. update to 1.4.9
  2. set environment variable DEBUG=botium*
  3. run again
  4. post result
7ML0 commented 6 years ago

Here it is: debugOutput2.txt

codeforequity-at commented 6 years ago

I would say that your STARCMD capability ("node server.js") is missing an "npm install" - I think you should change it to "npm install && node server.js"

7ML0 commented 6 years ago

Hi, Thanks! I tried it - without luck sadly. The exact same thing happens, same log output. Any idea what else it could be? It looks like it never actually hits the server.js file...

codeforequity-at commented 6 years ago

In the botiumwork-subfolder there should be a logfile with the output from the docker containers (set CLEANUPTEMPDIR capability to false). Please post the content of this file, maybe there are some hints.

7ML0 commented 6 years ago

is that either of the docker-env.yml or docker-compose.botium.yml files, or a log file inside the fbmock subfolder? Sorry I'm not very familiar with docker so don't quite know which one you mean

7ML0 commented 6 years ago
screen shot 2018-11-12 at 14 38 47

This is all that I have in the most recent subfolder in botiumwork

7ML0 commented 6 years ago

i've been comparing those files to the ones generated when I run the sample (which works), and I can't see anything strikingly different (though tbh I don't know what I should be looking for)

codeforequity-at commented 6 years ago

Nothing looks wrong, except that the docker container holding the chatbot doesn't come up - in the log you can see that for the first few seconds, the container is there but not started, but then it gets stopped (the messages "getaddrinfo ENOTFOUND botium" point to this).

Obviously, the docker syslog driver is not working in your environment, there should be a file "docker-containers-log.txt" in the botiumwork-directory. Without this logging, it is very hard to find out what's actually failing.

You wrote that a sample is working - so your docker installation is not the problem. What's in your server.js ? is it something which can fail ? can you provide me the file so I can test in my environment ?

7ML0 commented 6 years ago

In the sample, that log file (docker-contrainers-log.txt) doesn't appear in the botiumwork subdirectory either though... the files there have the same structure as in the screenshot previously from my repo. Yet the sample definitely works, see log below: botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +0ms botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - checking endpoint http://127.0.0.1:46300 before proceed +2s botium-FacebookMock Mock - endpoint http://127.0.0.1:46300 is online +168ms botium-FacebookMock Mock - socket connected http://127.0.0.1:46300 +41ms botium-FacebookMock Mock - socket received from bot { sourceData: botium-FacebookMock { recipient: { id: 'me' }, botium-FacebookMock message: { text: 'Text received, echo: hello' } }, botium-FacebookMock messageText: 'Text received, echo: hello' } +174ms

and finally 3 specs, 0 failures ...

And the examples provided by docker upon install to check that your setup works worked fine for me a couple of days ago (their hello-world image etc...).

As for sharing my code, I'm not allowed to I'm afraid. I've got debugging outputs in server.js which i would have seen if something had failed - i'll look into it though. Thanks again for the help!