ZenPacks and JSON API

Expand all | Collapse all

Zenpack Development Testing

  • 1.  Zenpack Development Testing

    Posted 03-03-2019 04:37 AM
    Good Morning,

    is there a best practice for testing new Zenpacks? It's a little bit annoying to wait until Zenoss has restarted every time I changed the code of a new Zenpack and committed the container.

    Any hints are appreciated.

    Thanks, Martin

    ------------------------------
    Martin
    CompanyName
    ------------------------------


  • 2.  RE: Zenpack Development Testing

    Posted 03-03-2019 10:55 AM
    Hello Martin,

    Have you been following the directions here? Welcome to the ZenPack SDK! - ZenPack SDK 2.1.1 documentation 

    Between that and Jane Curry's pdfZenPack Developers' Guide, you can get a pretty good workflow that does not involve a full restart with each code change. It all depends on which part of the code you modify, but some code changed don't even require restarts, others just a restart of a few containers.

    On the other hand, for some code changes you actually need to uninstall a zenpack before you even make a code change (like any sort of relationship modification). I found this out the hard way.

    Morgan

    ------------------------------
    Morgan Timney
    The Southern Company
    Birmingham AL
    ------------------------------



  • 3.  RE: Zenpack Development Testing

    Posted 03-06-2019 09:01 AM
    Martin,
    For the ZenPacks I developed in my Professional Services role at Zenoss, I developed a way to do unit testing of ZenPacks without a running Zenoss. It's not a best practice, just a repeatable way to help develop a ZenPack quickly and catch silly errors early. You will still need to do final testing within a running Zenoss but it should cut down on how many times you have to do that. Please find the documentation attached along with a python script that is referenced. You will need to rename build_zenpack.txt to build_zenpack.py. I'm sure there's mistakes so feedback welcome.

    Thanks
    -Patrick

    ------------------------------
    Patrick McMahon
    Sr. Security and Compliance Specialist
    Zenoss
    ------------------------------



  • 4.  RE: Zenpack Development Testing

    Posted 03-14-2019 11:45 AM
    Thanks  Patrick, I will certainly try this out.

    ------------------------------
    Martin
    CompanyName
    ------------------------------



  • 5.  RE: Zenpack Development Testing

    Posted 03-14-2019 09:38 AM
    I tend to develop ZenPacks on a Zenoss 4 platform, even if the ultimate target is Zenoss 5/6 - much faster to restart stuff and more chance of just restarting the affected daemons.


    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 6.  RE: Zenpack Development Testing

    Posted 04-03-2019 07:47 AM
    I develop on Zenoss 4 as well. It has such a smaller footprint and it quicker to restart needed services and set traces.

    With that said, I do have a 6 instance I push my ZenPacks to for testing and also when I need to develop strictly against a 6 instance.

    @Morgan is correct, some services you do not need to even restart. If you are following the ZPL Dev guide to setup your environment and are using the shared /z directory, then you can just connect to a container and run the daemon for a quick test most of the time.

    Also, what restarts are needed is dependent on what you are writing/editing.

    Some examples:

    YAML files - ZP needs to be installed for changes to take place
    Datasource collect method and beyond (onSuccess, onError, etc) - Just the collection damon
    Datasource params and config - zenhub restart
    Modelers - zenmodeler restart




    ------------------------------
    jstanley
    ------------------------------