Code Monkey home page Code Monkey logo

Comments (3)

Lenka42 avatar Lenka42 commented on June 25, 2024

@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.

from gmqtt.

Lenka42 avatar Lenka42 commented on June 25, 2024

@fabaff any ideas about how we can do better?

from gmqtt.

fabaff avatar fabaff commented on June 25, 2024

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.

from gmqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.