Git Product home page Git Product logo

Comments (6)

iranzo avatar iranzo commented on June 12, 2024

@larsks what do you think about something like this to get some kind of unit testing for shell scripts?

from risu.

larsks avatar larsks commented on June 12, 2024

I think some sort of testing for the plugins would be a good idea. I'm not sure about this particular scheme, though, because $COMPONENT would be hard to specify (that is, if you want to test plugins/pacemaker/stonith_enabled.sh, what is $COMPONENT?).

An alternative would be to have the test look for a directory named after the plugin, and use that as the filesystem snapshot for testing the plugin. For example, for testing plugins/pacemaker/stonith_enabled.sh, we would look for a directory tests/snapshots/pacemaker/stonith_enabled.sh_pass, and then run:

docitellus(live=False, path=`tests/snapshots/pacemaker/stonith_enabled.sh_pass`, plugins=[the_plugin])

And then assert that the plugin result is successful.

How does that sound? I am making this up as I go along, but it seems to offer a fair amount of flexibility.

from risu.

iranzo avatar iranzo commented on June 12, 2024

My idea was to write 'test_pacemaker_fail.sh so it precreates required files so the .sh file fails (actual test)

and use 'pacemaker' as filter for the plugins to use

The second approach is also good, but puts more 'data' in the git repo while the other, creates it on the fly

from risu.

larsks avatar larsks commented on June 12, 2024

Well, you have the same data in both cases. In my case it lives on disk in files where it can be used as is, while in your example it lives in the scripts and is written out for each test run. I guess implement a couple of tests and see how things work out.

from risu.

iranzo avatar iranzo commented on June 12, 2024

@larsks https://review.gerrithub.io/374645 check that one

from risu.

iranzo avatar iranzo commented on June 12, 2024

Merged as separated tests per plugin

from risu.

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.