Skip to content

Creating a toxic for an existent proxy gives an exception #15

@joaoasrosa

Description

@joaoasrosa

Issue
I'm trying to add an experiment to the catalogue. The idea is to use toxiproxy, and proxy the calls to a mysql database. With that, I can control the type of faults that would be injected,
The environment is on AWS: toxiproxy in a ubuntu machine, and mysql in a rds instance. The app is .net core (not relevant) and exposes a REST API.

The experiment verifies the steady-state (one of the API endpoints) and then creates a toxic. The proxy is already created, due to the fact that the app needs to connect to it.
However, when trying to create the toxic, there is an error:

[2019-10-21 09:47:38 ERROR] [toxiproxyapi:68] Unable to create toxic for proxy: mysql

Digging into that, I used postman to post the same payload to the endpoint. The payload generated by the chaostollokit extensions:

[2019-10-21 09:47:38 INFO] [actions:39] Creating toxy mysql-latency for proxy mysql with type: latency as a downstream with toxicity 1.0 and attributes {'latency': '1234', 'jitter': '89'}

Extracting the full payload (on my environment added a line to output the json), looks like this:

[2019-10-21 09:47:38 DEBUG] [actions:46] json format for toxy creation: {'name': 'mysql-latency', 'type': 'latency', 'stream': 'downstream', 'toxicity': 1.0, 'attributes': {'latency': '1234', 'jitter': '89'}}

Using the same payload on postman, I get the full error:

{"error":"bad request body: json: cannot unmarshal string into Go struct field LatencyToxic.latency of type int64","status":400}

Although the attributes are of type int (from what I got in the code), when parsed to json transforms into string. Toxiproxy is picky with the types.

Environment

  • Toxiproxy
    • Version: 2.1.4
    • OS: Ubuntu
  • Chaostoolkit
    • Version 1.3.0
    • OS: Cataliana 10.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions