Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Conversation

@guerinoni
Copy link
Contributor

The purpose of this PR is to add a structure for running locally functional tests about API.
For this, we are using a docker image while developing in order to have a reproducible environment also for CI on GitHub, the link for image https://hub.docker.com/r/guerra1994/go-mqtt-docker-env.
The documentation is updated also about running tests in local machines.
I just added a test for docker ps -a API and it checks the output of the command executed on bash and the message from broker MQTT. It allows us to avoid to follow a sequential order running tests but is consistent with what container are in the machine because it checks that 2 output figure out the same container id.
In order to automate steps explained in README.md there is a script that starts mosquitto, exec tests and kills it, to restore a correct state of the docker container.

Federico Guerinoni and others added 25 commits July 20, 2020 14:47
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
This test is a functional test running locally using a properly
env in with docker and mosquitto.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Add MqttSendAndReceiveTimeout helper to verify if the expected response
comes before a timeout expires

Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
I added a ctor for a local MQTT configuration for type MqttTestClient
in order to other tests working as is.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Adding this we can check real output on machine. The assert is only
on second line of output because first line is a docker header.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
In this case I removed different implementation used to post on
aws or in local test. Now is more clean using only callback.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
In this case I use to check real docker ps -a command called with exec
and msg from mqtt, I want check len of array of docker container in
machine. Using this we are uncoupled from status of machine container
but the focus is on correctly respond by production code of application.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Fabio Falzoi <fabio@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
@guerinoni guerinoni requested review from pippolo84 and rsora July 23, 2020 11:04
Copy link
Contributor

@rsora rsora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested some fixes for minor/style issues. Please review them and give feedback if needed.

Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Federico Guerinoni added 2 commits July 23, 2020 17:34
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
Signed-off-by: Federico Guerinoni <fguerinoni@develer.com>
@guerinoni guerinoni requested a review from pippolo84 July 23, 2020 15:41
@pippolo84 pippolo84 merged commit c272a1f into master Jul 23, 2020
@guerinoni guerinoni deleted the functional-tests branch August 4, 2020 08:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants