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

Variable in included-configs not replaced with their value when variable is defined in included config #1872

Open
mhanysz-nexenio opened this issue Oct 11, 2024 · 0 comments

Comments

@mhanysz-nexenio
Copy link

Observed behaviour

When including a config containing a scenario that uses a variable in a request url that is defined in the included config itself, the url gets an extra "http:/" prefix that is not defined anywhere.

There are two .yml files, main.yml and module-with-variables.yml. main.yml includes module-with-variables.yml via included-configs. module-with-variables.yml defines a scenario that uses a variable in the request url like url: ${url}/login. The variable is defined in module-with-variables.yml as well. When running the test, the variable is not resolved and the list of requests contains | ${url}/login | FAIL | 0.00% | 0.000 | Non HTTP response message: Illegal character in path at index 7: http:/${url}/login

Defining the variable in main.yml fixes this issue, but since the variable is not used anywhere else outside of the included config, I'd like to keep it in the included config itself. The use-case I'm trying to implement is extracting the login to my system under test into a separate .yml file in order to reuse it for multiple scenarios.

Expected behaviour

Variables in included configs that are defined in the included config itself should be replaced as usual. The way I read the documentation on included-configs (https://gettaurus.org/docs/ConfigSyntax/#Included-Configs) it sounds like the included configs should be merged into the file including them and after that be processed as usual. So the variables should work as if they were defined in a single file.

Steps to reproduce

  1. create the following two files:
  • main.yml:
    ---
    execution:
    - concurrency: 1
      scenario: main
    
    included-configs:
      - module-with-variables.yml
    
    scenarios:
      main:
        requests:
          - include-scenario: module-with-variables
          - https://localhost/doSomething
    
  • module-with-variables.yml:
    ---
    scenarios:
      module-with-variables:
        variables:
          url: https://localhost
        requests:
          - ${url}/login
    
  1. run bzt ./main.yml
  • observe that the first url that is called is http:/${url}/login, so the ${url} variable is not replaced and an extra http:/ appears.

Affected Taurus version

[2024-10-11 12:21:25,551 INFO root] Taurus CLI Tool v1.16.34
[2024-10-11 12:21:25,552 DEBUG root] Build: 14646 Thu Aug 15 11:34:03 UTC 2024
[2024-10-11 12:21:25,552 DEBUG root] Extended git info:  7e511f08 Release 1.16.34 Changelog
[2024-10-11 12:21:25,552 DEBUG root] Command-line options: {'log': 'C:\\Users\\MARTIN~1\\AppData\\Local\\Temp\\bzt_o7grmv1p.log', 'option': None, 'quiet': None, 'verbose': None, 'no_system_configs': None, 'aliases': []}
[2024-10-11 12:21:25,552 DEBUG root] Python: CPython 3.12.4
[2024-10-11 12:21:25,552 DEBUG root] OS: uname_result(system='Windows', node='<redacted>', release='10', version='10.0.19045', machine='AMD64')
[2024-10-11 12:21:25,553 DEBUG root] Path to interpreter: C:\Users\MartinHanysz\AppData\Local\Programs\Python\Python312\python.exe
[2024-10-11 12:21:25,553 DEBUG root] Path to packages: ['C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\bzt.exe', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\DLLs', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\Lib', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312', 'C:\\Users\\MartinHanysz\\AppData\\Roaming\\Python\\Python312\\site-packages', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages', 'C:\\Users\\MartinHanysz\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\setuptools\\_vendor']
[2024-10-11 12:21:25,561 DEBUG root] Default python: C:\Users\MartinHanysz\AppData\Local\Programs\Python\Python312\python.EXE
[2024-10-11 12:21:25,568 DEBUG root] Default python3: C:\Users\MartinHanysz\AppData\Local\Microsoft\WindowsApps\python3.EXE
[2024-10-11 12:21:25,568 DEBUG root] Using personal config: C:\Users\MartinHanysz\.bzt-rc

.bzt-rc only contains commented out settings.

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