Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when trying to use with, assert, and variables together #68

Open
Kocal opened this issue Feb 10, 2022 · 1 comment
Open

Issue when trying to use with, assert, and variables together #68

Kocal opened this issue Feb 10, 2022 · 1 comment

Comments

@Kocal
Copy link
Contributor

Kocal commented Feb 10, 2022

Hi!

I'm trying to combine the usage of with and assert in order to write a single visit url() block which will be driven by configuration (from the with).

Here is our .blackfire.yaml:

scenarios: |
    #!blackfire-player

    scenario
        name "Performance regression"

        with slug, data in \
            { \
                '/a': { name: 'A', maxWallTime: '1s' }, \
                '/b': { name: 'B', maxWallTime: '2s' }, \
                '/c': { name: 'C', maxWallTime: '3s' }
            }

            visit url(slug)
                samples 3
                warmup true
                name "Checking performance for " ~ data['name']
                expect status_code() == 200
                assert main.wall_time < data["maxWallTime"] * var('time_coeff', 1)
                assert percent(main.wall_time) < 10%

The issue is caused by the usage of data["maxWallTime"].
I've tried different syntaxes but it still fails (with different error message tho):

  1. assert main.wall_time < data["maxWallTime"] * var('time_coeff', 1):
Unexpected characters (maxWallTime"]) at line 3 (near "assertions: ["main.wall_time < data["maxWallTime"] * var('time_coeff', 1)"]") in the request configuration (config_yml)
  1. assert main.wall_time < data['maxWallTime'] * var('time_coeff', 1):
Invalid configuration for path "tests._assertion_2.assertions.0.expression": Variable "data" is not valid around position 18 for expression `main.wall_time < data['maxWallTime'] * var('time_coeff', 1)`. Did you forget to prefix your variable with "main.", "metrics.", "runtime.", or "vars."?
  1. assert main.wall_time < data.maxWallTime * var('time_coeff', 1):
Invalid configuration for path "tests._assertion_2.assertions.0.expression": Variable "data" is not valid around position 18 for expression `main.wall_time < data.maxWallTime * var('time_coeff', 1)`. Did you forget to prefix your variable with "main.", "metrics.", "runtime.", or "vars."?

Does someone know how to make things working?

Thanks!

@Kocal
Copy link
Contributor Author

Kocal commented Nov 3, 2022

Anyone? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant