getanteon / anteon

Anteon (formerly Ddosify) - Effortless Kubernetes Monitoring and Performance Testing. Available on CLI, Self-Hosted, and Cloud
https://getanteon.com
GNU Affero General Public License v3.0
8.39k stars 379 forks source link

Error: "cannot unmarshal object into Go struct field jsonReaderAlias.steps of type string" #127

Closed douglasg14b closed 2 months ago

douglasg14b commented 1 year ago

Might be because of a mistake in the config? Either way the error should probably indicate what the problem is as opposed to be unhanded.

Command: ddosify -config loadTestConfig.json

Config:

{
    "iteration_count": 3000,
    "debug" : false,
    "load_type": "linear",
    "duration": 30,
    "steps": [
        {
            "id": 1,
            "url": "[redacted]",
            "method": "POST",
            "payload": {
                "eventData": {
                  "type": "action",
                  "name": "ButtonClick_SendVerificationButton",
                  "buttonName": "back"
                },
                "context": {
                  "identities": { "deviceId": "abcd-1234", "customerId": "abcd-1234" },
                  "meta": {
                    "isTest": true,
                    "artificial": true
                  }
                }
              },
            "timeout": 2
        }
    ]
}
douglasg14b commented 1 year ago

This is because the JSON isn't provided as an escaped string, this could be turned into a feature request to handle the existing JSON payload?

fatihbaltaci commented 1 year ago

Hi @douglasg14b, you can use payload_file key instead of payload like this:

Config:

{
  "iteration_count": 3000,
  "debug" : false,
  "load_type": "linear",
  "duration": 30,
  "steps": [
      {
          "id": 1,
          "url": "[redacted]",
          "method": "POST",
          "payload_file": "payload.json",
          "timeout": 2
      }
  ]
}

payload.json:

{
    "eventData": {
      "type": "action",
      "name": "ButtonClick_SendVerificationButton",
      "buttonName": "back"
    },
    "context": {
      "identities": { "deviceId": "abcd-1234", "customerId": "abcd-1234" },
      "meta": {
        "isTest": true,
        "artificial": true
      }
    }
  }