Skip to content

Commit

Permalink
python/iot3: add test of simple API without OTLP collector
Browse files Browse the repository at this point in the history
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
  • Loading branch information
ymorin-orange committed Jan 14, 2025
1 parent dd5de3b commit 52aa2d9
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion python/iot3/tests/test-iot3-core
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import time


def recv(data, topic, payload):
print(f"{topic[:16]}: {payload[:16]}")
print(f"{topic}: {payload[:16]}")


print("IoT3 Core SDK with MQTT and OTLP")

config = iot3.core.sample_config
config["mqtt"] = {
"host": "test.mosquitto.org",
Expand All @@ -34,3 +36,25 @@ iot3.core.publish(f"{topic}/passed", "passed")
time.sleep(1)

iot3.core.stop()


print("IoT3 Core SDK with MQTT and no OTLP")

del config["otel"]

topic = "test/" + random.randbytes(16).hex() + "/iot3/no-otlp"

iot3.core.start(
config=config,
message_callback=recv,
)

iot3.core.subscribe(f"{topic}/+")

iot3.core.publish(f"{topic}/dropped", "dropped")
time.sleep(1)

iot3.core.publish(f"{topic}/passed", "passed")
time.sleep(1)

iot3.core.stop()

0 comments on commit 52aa2d9

Please sign in to comment.