Zooz / predator

A powerful open-source platform for load testing APIs.
https://zooz.github.io/predator/
Apache License 2.0
576 stars 109 forks source link

Runner: tests fail to start due to missing RUN_ID #527

Closed bruno-villa closed 4 years ago

bruno-villa commented 4 years ago

Describe the bug Test jobs will exit with Error: Missing mandatory variables: RUN_ID

To Reproduce Steps to reproduce the behavior:

  1. Start a container
    docker run -d --rm -e SQLITE_STORAGE=db/predator -e JOB_PLATFORM=DOCKER -e INTERNAL_ADDRESS=http://${IP}:8080/v1 -p 8080:80 --name predator -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/predator:/usr/db zooz/predator
  2. Create a test in the UI - in my case a simple GET request
    {
    "id": "29a9c2a5-8dda-451e-9fce-2fa0ab64dbb8",
    "name": "Get topics",
    "description": "",
    "type": "basic",
    "updated_at": "2020-10-27T09:58:25.525Z",
    "revision_id": "9d61b487-4cd6-4086-85c7-7dd1a95af357",
    "artillery_test": {
    "config": {
      "target": "https://${HOSTNAME}:443",
      "plugins": {
        "expect": {}
      }
    },
    "scenarios": [
      {
        "name": "Scenario 1",
        "weight": 100,
        "flow": [
          {
            "get": {
              "url": "/topics",
              "name": "topics",
              "headers": {
                "accept": "application/vnd.kafka.v2+json"
              },
              "capture": [],
              "expect": [
                {
                  "statusCode": "200"
                }
              ],
              "gzip": true,
              "forever": true
            }
          }
        ]
      }
    ]
    }
    }
  3. Run the test
  4. It shows up with status failed in the UI
  5. 
    $ docker logs $(docker ps -a -f name=predator -n 1 --format='{{ .ID }}')                                                               
    {"name":"predator-runner","hostname":"99900c1f23cc","pid":1,"level":50,"err":{"message":"Missing mandatory variables: RUN_ID","name":"Error","stack":"Error: Missing mandatory variables: RUN_ID\n    at Object.module.exports.verifyEnvironmentVars (/usr/app/utils/verifier.js:37:21)\n    at Object.<anonymous> (/usr/app/app.js:2:29)\n    at Module._compile (module.js:653:30)\n    at Object.Module._extensions..js (module.js:664:10)\n    at Module.load (module.js:566:32)\n    at tryModuleLoad (module.js:506:12)\n    at Function.Module._load (module.js:498:3)\n    at Function.Module.runMain (module.js:694:10)\n    at startup (bootstrap_node.js:204:16)\n    at bootstrap_node.js:625:3"},"msg":"Missing mandatory variables: RUN_ID","time":"2020-10-27T09:59:35.975Z","v":0}
    /usr/app/utils/verifier.js:39
        throw error;
        ^

Error: Missing mandatory variables: RUN_ID at Object.module.exports.verifyEnvironmentVars (/usr/app/utils/verifier.js:37:21) at Object. (/usr/app/app.js:2:29) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3



**Expected behavior**
Expected the test to start and send GET requests.

**Version:**
 - Predator: 1.5.4
 - Predator-runner 1.5
 - Database sqlite
enudler commented 4 years ago

hi @bruno-villa

can you please download latest docker of predator-runner and try again docker pull zooz/predator-runner:latest

bruno-villa commented 4 years ago

Hi,

thank you for such a quick reply. I tried that and also ran docker image rm zooz/predator-runner:1.5. Re-running the test yields the same error and I see predator-runner:1.5 in my list of images so predator seems to be pulling this specific version (which I thought would be the same).

enudler commented 4 years ago

Hi @bruno-villa

The problem is that the predator image and predator-runner are not matched.

for predator you use master and for predator-runner 1.5

I advise start predator with 1.5 tagged image:

docker run -d --rm -e SQLITE_STORAGE=db/predator -e JOB_PLATFORM=DOCKER -e INTERNAL_ADDRESS=http://${IP}:8080/v1 -p 8080:80 --name predator -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/predator:/usr/db zooz/predator:1.5

bruno-villa commented 4 years ago

Hi @enudler Indeed, specifying version 1.5 of the image solves the issue (the UI still says 1.5.4 though). I can confirm tests are now running as expected so I'll close the issue. Thank you.