Tags do not apply to included files
michaelsproul opened this issue · 2 comments
I tried defining a top-level file to combine requests from multiple files like this:
# all.yaml
---
base: "http://localhost:3000"
plan:
- include: ./file1.yaml
- include: ./file2.yaml
# file1.yaml
---
- name: is_tagged
request:
url: /is_tagged
tags: [example1]
# file1.yaml
---
- name: is_not_tagged
request:
url: /is_not_tagged
I found that tags in file1.yaml
and file2.yaml
are ignored. Running with --tags example1
doesn't include the is_tagged
action from file1.yaml
(it includes nothing).
I had a play with the code and it's because the tag system operates on the unexpanded YAML and expects tags on top-level items only, here:
Lines 29 to 55 in f7627bf
As a workaround I'm grouping my include files by their tags like this:
# all.yaml
plan:
- include: ./file1.yaml
tags: [example1]
- include: ./file2.yaml
Figured I would document this here so that this behaviour is known. If we wanted to codify it maybe tags
on included files could be rejected when loading/parsing? Alternatively, the tag system could be extended to work with recursively included files.
Related: #132
Thanks for this report! I vote for the recursive approach because it's the most intuitive one. I can work on a fix.