mqtt_tests: add weekend test for sending and receiving empty payload messages, update config options per new naming convetions

This commit is contained in:
David Cermak 2019-05-06 16:14:48 +02:00
parent 38d15cbd63
commit 7963ac65af

View file

@ -71,11 +71,11 @@ def test_single_config(dut, transport, qos, repeat, published):
global expected_data global expected_data
global message_log global message_log
sample_string = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(16)) sample_string = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(16))
print("PUBLISH TEST: transport:{}, qos:{}, sequence:{}, sample msg:{}".format(transport, qos, published, sample_string))
event_client_connected.clear() event_client_connected.clear()
expected_count = 0 expected_count = 0
message_log = "" message_log = ""
expected_data = sample_string * repeat expected_data = sample_string * repeat
print("PUBLISH TEST: transport:{}, qos:{}, sequence:{}, sample msg:'{}'".format(transport, qos, published, expected_data))
client = None client = None
try: try:
if transport in ["ws", "wss"]: if transport in ["ws", "wss"]:
@ -148,12 +148,12 @@ def test_weekend_mqtt_publish(env, extra_data):
# Look for host:port in sdkconfig # Look for host:port in sdkconfig
try: try:
# python client subscribes to the topic to which esp client publishes and vice versa # python client subscribes to the topic to which esp client publishes and vice versa
publish_topic = dut1.app.get_sdkconfig()["CONFIG_SUBSCIBE_TOPIC"].replace('"','') publish_topic = dut1.app.get_sdkconfig()["CONFIG_EXAMPLE_SUBSCIBE_TOPIC"].replace('"','')
subscribe_topic = dut1.app.get_sdkconfig()["CONFIG_PUBLISH_TOPIC"].replace('"','') subscribe_topic = dut1.app.get_sdkconfig()["CONFIG_EXAMPLE_PUBLISH_TOPIC"].replace('"','')
broker_host["ssl"], broker_port["ssl"] = get_host_port_from_dut(dut1, "CONFIG_BROKER_SSL_URI") broker_host["ssl"], broker_port["ssl"] = get_host_port_from_dut(dut1, "CONFIG_EXAMPLE_BROKER_SSL_URI")
broker_host["tcp"], broker_port["tcp"] = get_host_port_from_dut(dut1, "CONFIG_BROKER_TCP_URI") broker_host["tcp"], broker_port["tcp"] = get_host_port_from_dut(dut1, "CONFIG_EXAMPLE_BROKER_TCP_URI")
broker_host["ws"], broker_port["ws"] = get_host_port_from_dut(dut1, "CONFIG_BROKER_WS_URI") broker_host["ws"], broker_port["ws"] = get_host_port_from_dut(dut1, "CONFIG_EXAMPLE_BROKER_WS_URI")
broker_host["wss"], broker_port["wss"] = get_host_port_from_dut(dut1, "CONFIG_BROKER_WSS_URI") broker_host["wss"], broker_port["wss"] = get_host_port_from_dut(dut1, "CONFIG_EXAMPLE_BROKER_WSS_URI")
except Exception: except Exception:
print('ENV_TEST_FAILURE: Cannot find broker url in sdkconfig') print('ENV_TEST_FAILURE: Cannot find broker url in sdkconfig')
raise raise
@ -166,8 +166,10 @@ def test_weekend_mqtt_publish(env, extra_data):
raise raise
for qos in [0, 1, 2]: for qos in [0, 1, 2]:
for transport in ["tcp", "ssl", "ws", "wss"]: for transport in ["tcp", "ssl", "ws", "wss"]:
# simple test with empty message
test_single_config(dut1, transport, qos, 0, 5)
# decide on broker what level of test will pass (local broker works the best) # decide on broker what level of test will pass (local broker works the best)
if broker_host[transport].startswith("192.168"): if broker_host[transport].startswith("192.168") and qos < 1:
# medium size, medium repeated # medium size, medium repeated
test_single_config(dut1, transport, qos, 5, 50) test_single_config(dut1, transport, qos, 5, 50)
# long data # long data