Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis docker #10

Merged
merged 6 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
language: python

services:
- docker
python:
- "2.7"

- '2.7'
before_install:
- docker pull eclipse-mosquitto
- docker run -d -p 1883:1883 -p 9001:9001 -v $(pwd)/mosquitto:/mosquitto/config eclipse-mosquitto
install:
- "pip install -r requirements.txt"

- pip install -r requirements.txt
script:
- pybot -P src -e local-only tests
- pybot -P src tests
deploy:
- provider: pypi
user: randomsync
password:
secure: JGikGMEMaDKQr50zDtj/ZE9haWhoJgC8nJEaNwrj9PaHePwQQ7tvDsi453k1zd3T3yQrrVe8oKB1fqzLViwSv6y3LO4j12fVrKTYcLPJCUSJo+FV/m3aDwD5Ps1QjcSO16zRudqyikcn+ESoWHl3VnVJ2f9h/88/XBRpChpyZuk=
on:
repo: randomsync/robotframework-mqttlibrary
tags: true
- provider: releases
api_key:
secure: JAaqldr74M3AwKBUAyCoeEdeFotPgXlSO7ML6IWpv327UXsz/CZyZg3lDnFZEPyUfzr/pndUEN/M/eeHTuLMXVhv5rdaiMWS5pXXcs6mmR7irT5LK3giRJKJpfNWcOTCRkotHJRkMC7vOuHWhuLrJ0a7v4yxZyTcqBsQUq+Qk/Q=
file: dist/*
skip_cleanup: true
draft: true
on:
repo: randomsync/robotframework-mqttlibrary
tags: true
24 changes: 23 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Connect to the broker, subscribe and validate that a message is received:
.. code-block:: robotframework

*** Test Cases ***
Subsribe and Validate
Subscribe and Validate
Connect 127.0.0.1
Subscribe and Validate topic=test/mqtt_test qos=1 payload=test
[Teardown] Disconnect
Expand All @@ -65,3 +65,25 @@ For general information about using test libraries with Robot Framework, see
`Robot Framework User Guide`__.

__ http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-test-libraries

Contributing
------------

The keywords in this library are based on some of the methods available in eclipse paho client library. If you'd like to add keywords, see instructions_ on creating/updating libraries for Robot Framework.

The tests are in ``tests`` folder and make use of Robot Framework itself. They are run automatically through travis when code is pushed to a branch. Most of the tests rely on the public mqtt broker at iot.eclipse.org, but some that validate authentication rely on a local broker. You can start a local broker with the provided configuration. You can then run the tests locally::

docker pull eclipse-mosquitto
docker run -d -p 1883:1883 -p 9001:9001 -v $(pwd)/mosquitto:/mosquitto/config eclipse-mosquitto
pybot -P src tests


Make sure to stop the docker container when it is no longer needed.

.. _instructions: http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-test-libraries

License
-------
MQTTLibrary is open source software provided under the `Apache License 2.0`__.

__ http://apache.org/licenses/LICENSE-2.0
File renamed without changes.
2 changes: 2 additions & 0 deletions mosquitto/mosquitto.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
allow_anonymous false
password_file ./mosquitto/config/passwd_file
2 changes: 2 additions & 0 deletions mosquitto/passwd_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
authuser1:$6$TR6FgFf+wMRzsgUQ$2AGKs3SinFVlSKbaqm9vcWNfmFM4c/Sg53SfpXJNXDb6iFjRdmqkMhEYM5sHRMFwXEosC3HQtuooPu6piRVb4A==
authuser2:$6$l/sj6c5ubQOEFoKi$9qWQ47H3IBI4LeORK7PpUBP2FYhOxHBanwtaBahv039nO+6AVXLNwmdmUnekYB+u8BV8Kx0UqdBhplpYoM737Q==
22 changes: 14 additions & 8 deletions tests/pubsub.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,28 @@
| | LOG | ${messages}
| | Length Should Be | ${messages} | 0

| Publish to a broker that requires username, password authentication
| | [Tags] | local-only
| Publish and Subscribe to a broker that requires username, password authentication
| | [Tags] | auth
| | ${time} | Get Time | epoch
| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time}
| | ${topic} | Set Variable | test
| | Set username and password | user1 | test1
| | Connect | 127.0.0.1 | 1883 | ${client}
| | Publish | ${topic} | test message with username and password
| | ${message} | Set Variable | subscription test message
| | Set username and password | authuser1 | password1
| | Run Keyword And Expect Error | The expected payload didn't arrive in the topic
| | ... | Subscribe to MQTT Broker and Validate | broker.uri=127.0.0.1 | client.id=${client}
| | ... | topic=${topic} | message=${message}
| | Connect | 127.0.0.1
| | Publish | ${topic} | test message with username and password | qos=1
| | Subscribe to MQTT Broker and Validate
| | ... | broker.uri=127.0.0.1 | client.id=${client} | topic=${topic} | message=test message with username and password
| | [Teardown] | Disconnect

| Publish to a broker that requires username, password authentication with invalid password
| | [Tags] | local-only
| Publish to a broker that requires authentication with invalid password
| | [Tags] | auth
| | ${time} | Get Time | epoch
| | ${client} | Catenate | SEPARATOR=. | robot.mqtt | ${time}
| | ${topic} | Set Variable | test
| | Set username and password | user1 | test
| | Set username and password | authuser1 | invalidpwd
| | Run Keyword and expect error | The client disconnected unexpectedly
| | ... | Connect | 127.0.0.1 | 1883 | ${client}
| | [Teardown] | Disconnect
Expand Down