Save block not available in MQTT_Response
felixbohnus opened this issue · 2 comments
felixbohnus commented
Hi
I tried to subscribe to a specific topic and publish a message depending on the received massage:
test_name: Receive and publish message
paho-mqtt:
!include ../shared/mqtt.config.yaml
stages:
- name: publish example message and wait for response
mqtt_publish:
topic: playground/publish
json:
msg: msg
mqtt_response:
topic: playground/receive
save:
json:
saved_msg: msg
timeout: 60
- name: publish received message
mqtt_publish:
topic: playground/publish_received_msg
json:
msg: "{saved_msg}"
Then I get the following error:
E tavern._core.exceptions.BadSchemaError:
E ---
E
E {'topic': 'playground/receive', 'save': {'json': {'saved_msg': 'msg'}}, 'timeout': 60} is not valid under any of the given schemas
E test\integration\playground.tavern.yaml: line 9-19:
E
E msg: msg
E mqtt_response:
E topic: playground/receive
E save:
E json:
E saved_msg: msg
E timeout: 60
E - name: publish received message
E mqtt_publish:
It is also not defined in the YAML-schema defining the tests:
https://github.com/taverntesting/tavern/blob/4396844435a74d0af4c06ca64eb1c15cf02b61ab/tavern/_core/schema/tests.jsonschema.yaml
So the question is: Is there another way to save and access variables from mqtt-responses?
michaelboulton commented
This used to work in Tavern 1.x but it seems like I accidentally broke it in the 2.0 release. I'll look at fixing it within the next few days but if you need this for the time being you may need to keep using tavern>=1,<2
felixbohnus commented
Works now, thank you for fixing it!