Unable to run xk6-browser binary file inside Docker - GoError: launching browser: exec: no command

Hi there,

I’m having trouble running:

  • ./xk6-browser run --env scenario=pullrequests tests/scenarios.js

inside Docker. It’s fine if I execute Mac’s xk6-browser binary file locally like using terminal… the tests running fine, but I have the whole framework also with using Docker, entrypoint.sh etc… and everything seems good until executing the binary file downloaded from GitHub (I want to work with downloaded binary file). I downloaded one for Linux, since Docker is running Linux and even I’m on Mac laptop.

What could be wrong? Seems like the k6 starts and then stops for some reason, here’s the output:

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: tests/scenarios.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 1m30s max duration (incl. graceful stop):
           * pullrequests: 1 iterations for each of 1 VUs (maxDuration: 1m0s, exec: pullRequests, gracefulStop: 30s)

ERRO[0002] GoError: launching browser: exec: no command
        at reflect.methodValueCall (native)
        at newsletterListing (file:///wp-core/wp-content/plugins/projectplugin/tests/performance/requests/wp-admin/testcase1.js:24:36(7))
        at pullRequests (file:///wp-core/wp-content/plugins/projectplugin/tests/performance/tests/scenarios.js:56:1(4))
        at native  executor=per-vu-iterations scenario=pullrequests source=stacktrace

In my entrypoint.sh file I wrote to execute xk6 perf tests as follows:

if [[ $TEST_TYPE == "performance" ]]; then
  echo "Executing xk6 performance tests";
  # Executing k6 performance tests
  cd wp-content/plugins/projectplugin/tests/performance/
  ./xk6-browser run --env scenario=pullrequests tests/scenarios.js
fi

Similar issue in another topic just for reference: Observing "GoError: launching browser: exec: no command while running browser tests on docker

I guess, this could be related to Chromium… that the test was unable to run for some reason. Should I try mentioning it somehow in entrypoint.sh?

This is definitely something with running the test as it fails on this line:

const browser = chromium.launch({ headless: true })

So the error is Go lang error about the chrome browser unable to run the test, for some reason.

Hi @moonbridge,

Welcome to the forum!

Could you send me your dockerfile that you are using to build the image? It does indeed seem to be due to not having a chrome browser installed in the docker image itself, which needs to be done in the dockerfile.

Cheers,
Ankur

Hi @ankur, thanks for the response! I realized it was chromium, yes. So I will try updating my existing Dockerfile image with it. What I tried is installing chromium through entrypoint.sh and it worked, but since it takes time I will update Dockerfile with chromium installation.