Regression test of docker base api


#1

New to CiricleCI. Can I test a built docker service with external tools in the test step or do I have to deploy to gain public accessibility? For example, I wan to test an api service with RunScope and then deploy.


#2

I’m looking to use Runscope as well. Is there anyone that knows the answer to the OP’s question?

@Eric @ryanarlan22 would either of you know?


#3

Hi Tom and Brian, I’d like to answer this, but I don’t have experience with RunScope. Browsing the homepage for RunScope didn’t help me understand how it fits together with Docker.

Could you describe the what a test workflow looks like in a little more detail? That should help me answer your question.


#4

A basic workflow would be:

  1. Start an instance of the application either within a docker container or directly on the build machine
  2. Signal Runscope with a web hook to start its tests (we would need our running application to be publicly accessible)
  3. Either through poling or web hook callback determine if the Runscope test were successful or not and pass / fail the build accordingly

#5

Okay, great. Thanks for that explanation.

Re: 1) Whether or not docker is in the picture seems irrelevant, so I’ll describe how to do this on the build machine.

Re: 2) The critical part of this is making your running application publicly accessible. You can do this with ngrok.

  • You’ll have to sign up with them, but they have a free plan to allow 1 ngrok process running at a time.
  • An ngrok CLI is available on our Precise containers, but it looks like this version (1.7) doesn’t connect to ngrok servers. I suggest downloading the ngrok 2 CLI.
  • You’ll have to start up your server, then auth with ngrok and start ngrok to open an introspective tunnel
  • Determine your ngrok tunnel address by quering the ngrok server: curl http://localhost:4040/api/tunnels and parse the response
  • Then you want to signal runscope with the the ngrok url + port that you parsed out. This should trigger Runscope to start running the tests.

Re: 3) This depends on Runscope having some kind of API to expose these details for you. A simple sleep 5; curl <url> should suffice for polling. For your CircleCI build, you just need to make sure you translate the response into a 0 or non-zero exit code.


#6

We can make that work. Thank you for your help!


#7

What would the easiest way be to install the desired version of ngrok? apt-get, curl, etc…


#8