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

CI is not running for PRs #86

Open
fabaff opened this issue Dec 30, 2019 · 3 comments
Open

CI is not running for PRs #86

fabaff opened this issue Dec 30, 2019 · 3 comments

Comments

@fabaff
Copy link
Contributor

fabaff commented Dec 30, 2019

The CI is not running on PRs. It seems that the credentials are not valid which are used by travis.

        if raise_exc and self._error:
>           raise self._error
E           gmqtt.mqtt.handler.MQTTConnectError: code 134 (Connection Refused: Bad User Name or Password)
@Lenka42
Copy link
Collaborator

Lenka42 commented Dec 30, 2019

@fabaff Actually this is expected behaviour (or I don't know how to handle this)
Our tests create connection to Flespi MQTT broker and it requires token taken from environment variable. And in general third-party PR can have any code, which can potentially cause token leak.
So the flow is following: if we have PR which looks good, we merge it to the feature-branch first and afterwards, if tests are OK, we merge it to master.

@Lenka42
Copy link
Collaborator

Lenka42 commented Dec 30, 2019

@fabaff any ideas about how we can do better?

@fabaff
Copy link
Contributor Author

fabaff commented Dec 30, 2019

Perhaps something like this could be helpful. If TOKEN is present then run the tests with flespi.io otherwise use a local MQTT broker.

if os.getenv('TOKEN'):
    host = 'mqtt.flespi.io'
    username = os.getenv("TOKEN")
    password = None
    port = 1883
else:
    host = os.getenv("HOST", "127.0.0.1")
    username = os.getenv("USERNAME", "")
    password = os.getenv("PASSWORD", None)
    port = os.getenv("PORT", 1883)

Not very elegant but would allow to run the tests locally before submitting a pull request. Perhaps it would require to add @pytest.mark.local to some tests to distinguish between a local MQTT broker and the one from flespi.io as a local broker usually doesn't support SSL/TLS in a default setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants