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

Feature: add MosquittoContainer (mqtt) #568

Open
f18m opened this issue May 10, 2024 · 4 comments
Open

Feature: add MosquittoContainer (mqtt) #568

f18m opened this issue May 10, 2024 · 4 comments

Comments

@f18m
Copy link
Contributor

f18m commented May 10, 2024

What are you trying to do?

I'm writing integration tests for a Python project (https://github.com/f18m/ha-alarm-raspy2mqtt) that publishes messages to an MQTT broker.
I would like to use testcontainers to create the integration tests and noticed that there is no specialization available for MQTT and for its most-used broker which is Mosquitto.
So I'd like to propose the addition of a MosquittoContainer class to testcontainers-python.

Why should it be done this way?

There are a number of helpers that could be provided out of the box to ease integration testing of MQTT applications.

I can provide a PR to add my own MosquittoContainer implementation if there is interest by the project maintainers...

@alexanderankin
Copy link
Collaborator

sure, i cant promise it will be a priority but we've been merging a bunch of these. the hivemq seems to be king in the enterprise world with this so id say if we do merge a mqtt one it has to be this one:

https://java.testcontainers.org/modules/hivemq/

@f18m
Copy link
Contributor Author

f18m commented May 11, 2024

hi @alexanderankin ,
thanks for the reply. Actually I've been developing the specialization of DockerContainer for the Mosquitto broker (https://mosquitto.org/) which is a very popular choice at least in home automation environment... I could contribute that if there's interest...

@alexanderankin
Copy link
Collaborator

hm, i suppose we could have a module with multiple classes in it

@f18m
Copy link
Contributor Author

f18m commented Jun 5, 2024

hi @alexanderankin ,
I opened PR #599 to propose my implementation of a MosquittoContainer class.
Several usage examples can be found at https://github.com/f18m/rpi2home-assistant/blob/main/tests/test_integration.py

alexanderankin added a commit that referenced this issue Jun 18, 2024
This PR is adding a new MosquittoContainer class that helps creating
integration tests for MQTT clients.
The MosquittoContainer class contains a bunch of methods to help with
testing:
* checking number of messages received 
* watching topics
* check last payload published on a particular topic
* etc

This PR lacks tests. I can add them if there is interest in this PR...

---------

Co-authored-by: Dave Ankin <daveankin@gmail.com>
alexanderankin pushed a commit that referenced this issue Jun 20, 2024
🤖 I have created a release *beep* *boop*
---


##
[4.6.0](testcontainers-v4.5.1...testcontainers-v4.6.0)
(2024-06-18)


### Features

* **core:** Added ServerContainer
([#595](#595))
([0768490](0768490))
* **core:** Image build (Dockerfile support)
([#585](#585))
([54c88cf](54c88cf))


### Bug Fixes

* Add Cockroach DB Module to Testcontainers
([#608](#608))
([4aff679](4aff679))
* Container for Milvus database
([#606](#606))
([ec76df2](ec76df2))
* move TESTCONTAINERS_HOST_OVERRIDE to config.py
([#603](#603))
([2a5a190](2a5a190)),
closes
[#602](#602)
* **mqtt:** Add mqtt.MosquittoContainer
([#568](#568))
([#599](#599))
([59cb6fc](59cb6fc))


### Documentation

* **main:** Private registry
([#598](#598))
([9045c0a](9045c0a))
* Update private registry instructions
([#604](#604))
([f5a019b](f5a019b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@alexanderankin alexanderankin changed the title Feature: add MosquittoContainer Feature: add MosquittoContainer (mqtt) Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants