diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-19 00:32:05 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-19 00:32:05 +0200 |
| commit | 56b14eb55d3078d38e07bc22aae73e73017b1257 (patch) | |
| tree | 82260e91c808ce05903749a3e0d571efc2a4c470 /test/interop/cleanup.c | |
| parent | 751480833388b1e56bbe7c24b523bf98d9d04383 (diff) | |
| download | mqtt-56b14eb55d3078d38e07bc22aae73e73017b1257.tar.gz mqtt-56b14eb55d3078d38e07bc22aae73e73017b1257.zip | |
Add more interop tests
Diffstat (limited to 'test/interop/cleanup.c')
| -rw-r--r-- | test/interop/cleanup.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/interop/cleanup.c b/test/interop/cleanup.c new file mode 100644 index 0000000..30e4684 --- /dev/null +++ b/test/interop/cleanup.c @@ -0,0 +1,39 @@ +static void cleanup() +{ + TestClient *client; + Message *msg; + + /* Clean client state */ + + client = TestClientNew("clienta"); + TestClientConnect(client, "localhost", 1883, 60, 1); + TestClientWait(client, 100); + TestClientDisconnect(client); + TestClientFree(client); + + client = TestClientNew("clientb"); + TestClientConnect(client, "localhost", 1883, 60, 1); + TestClientWait(client, 100); + TestClientDisconnect(client); + TestClientFree(client); + + /* Clean retained messages */ + + client = TestClientNew("clean-retained"); + TestClientConnect(client, "localhost", 1883, 60, 1); + TestClientSubscribe(client, "#", 0); + TestClientWait(client, 2000); + + SIMPLEQ_FOREACH(msg, &client->messages, chain) + { + if (msg->retain) + { + printf("deleting retained message for topic %s\n", msg->topic); + TestClientPublish(client, 0, 1, msg->topic, ""); + } + } + + TestClientDisconnect(client); + + TestClientFree(client); +} |
