Giter Site home page Giter Site logo

Comments (7)

Lawouach avatar Lawouach commented on May 31, 2024

Hey,

Indeed, the basic tolerance with a sequence like this one cannot handle the returned body from a HTTP probe. The reason is that such probe returns an object (a mapping) such as:

{
    "status": 200,
    "headers": {...},
    "body": "..."
}

Here, the default tolerance range will look at the status, not the actual body.

To support this, we actually need a more complex new tolerance type, following the principles of the jsonpath and regex tolerances.

"tolerance": {
    "type": "range",
    "target": "body",
    "range": {
        "min": 10,
        "max": 1000
    }
}

When the body is a string, this can be reduced to:

"tolerance": {
    "type": "range",
    "target": "body",
    "range": ["good", "better", "best"]
}

assuming:

{
    "status": 200,
    "headers": {...},
    "body": "bad"
}

Please have a look #84 and see if it helps?

from chaostoolkit-lib.

Lawouach avatar Lawouach commented on May 31, 2024

While discussing with @GerardMoscardo, I wondered if it wasn't confusing to have "range": ["good", "better", "best"]? Indeed, this could be achieved with a simple regex already. Maybe the range, should really stick to numerical values between low and high?

from chaostoolkit-lib.

GerardMoscardo avatar GerardMoscardo commented on May 31, 2024

Hello, IMO, as u said, range should be only used for numerical values.

from chaostoolkit-lib.

Lawouach avatar Lawouach commented on May 31, 2024

I agree.

In that case, should we use a shorter syntax:

"tolerance": {
    "type": "range",
    "target": "body",
    "range": [-10, 10]
}

Basically, low/high and the value must between those boundaries.

from chaostoolkit-lib.

GerardMoscardo avatar GerardMoscardo commented on May 31, 2024

This looks perfect, also shares syntax with the other probes already existing:

A sequence tolerance with lower and upper bounds:

"tolerance": [4, 9]

Thanks!

from chaostoolkit-lib.

Lawouach avatar Lawouach commented on May 31, 2024

Exactly!

I'll update the PR asap.

from chaostoolkit-lib.

Lawouach avatar Lawouach commented on May 31, 2024

Documented in chaostoolkit/chaostoolkit-documentation@c8a58f7

from chaostoolkit-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.