Giter VIP home page Giter VIP logo

glusto-libs's Introduction

Glusto Libs

glusto-libs repo contains the Libraries/Modules necessary for automating the gluster tests. It mainly provides python bindings for the GlusterD-2.0 APIs. Latest Code for this repo is managed on review.gluster.org

Refer the glusto-doc for info on glusto framework. Issues need to be filled against the Github repo.

To automate/run glusto-tests on GD2 environment we need to do following steps:

  • install glusto
  • clone glusto-libs repo
  • clone glusto-tests repo
  • install all packages (i.e, glustolibs-gluster-gd2, glustolibs-io and glustolibs-misc libraries)

How to install glusto:

One can use either of the three methods.

  • using pip

    # pip install --upgrade git+git://github.com/loadtheaccumulator/glusto.git
    
  • using git

    # git clone https://github.com/loadtheaccumulator/glusto.git
    # cd glusto
    # python setup.py install
    
  • using ansible: install glusto, glusto-tests

      # ansible-playbook -i host.ini glusto-tests/ansible/deploy-glusto.yaml
    

For more info refer the docs.

How to clone glusto-tests and glusto-libs repo:

How to install the glustolibs-gluster-gd2, glustolibs-io and glustolibs-misc libraries:

# git clone ssh://[email protected]/glusto-libs
# cd glusto-libs/glustolibs-gluster-gd2
# python setup.py install
# cd ../../glusto-tests/glustolibs-io
# python setup.py install
# cd ../../glusto-tests/glustolibs-misc
# python setup.py install

To install glusto-tests dependencies:

python-docx needs to be installed when we run IO's and validates on client node.

  • To install run:

    # easy_install pip # pip install --pre python-docx

How to run the test case:

  • Update the information about the servers, clients, servers_info, client_info, running_on_volumes, running_on_mounts and volume_create_force etc, which is necessary on the config fileconfig. Refer the following for more info link.

  • glusto-tests are run using the glusto command available after installing the glusto framework. The various options to run tests as provided by glusto framework:

    • To run PyTest tests:

      • To run all tests that are marked with tag 'bvt': # glusto -c config.yml --pytest='-v -x tests -m bvt'

      • To run all tests that are under bvt folder: # glusto -c config.yml --pytest='-v -s bvt/'

      • To run a single test case: # glusto -c config.yml --pytest='-v -s -k test_demo1'

    For more info about running these tests, refer the docs.

Writing tests/libraries for GD2:

  • tests directory in glusto-tests contain testcases. Testcases are written as component wise. Testcases name and file name should should start with test_.

  • glustolibs-gluster-gd2 directory in glusto-libs contains libraries for GD2 api's. Libraries for io's and miscellaneous are written on glustolibs-io and glustolibs-misc respectively. These functions or libraries can be used while writing testcases.

  • While writing testcases or libraries follow:

    • Please follow the PEP008 style-guide.

    • Makes sure all the pylint and pyflakes error are fixed For example:

         - C0326: Exactly one space required around assignment
         - C0111: Missing module doc-string (missing-doc string)
         - W: 50: Too long line
      

      For more information on pylint and on pyflakes

    • Optimize the code as much as possible. Eliminate the repetitive steps, write it has separate function.

    • Use proper python standards on returning values. This style guide is a list of do's and don’ts for Python programs.

    • Add docstring to every function you write

      For example: This is an example of a module level function

         def module(param1, param2):
             """
             Explain what the module function does in breif
      
             Args:
                 param1: The first parameter.
                 param2: The second parameter.
      
             Returns:
                 The return value of the function.
             """
      
    • Make sure the log messages are grammatically correct and have no spelling mistakes.

    • Comment every step of the test case/libraries, log the test step, test result, failure and success. For example:

         # peer status from mnode
         g.log.info("Get peer status from node %s", self.mnode)
         ret, out, err = peer_status(self.mnode)
         self.assertEqual(ret, 0, "Failed to get peer status from node %s: %s" % (self.mnode, err))
         g.log.info("Successfully got peer status from node %s:\n%s", self.mnode, out)
      
    • Don't not use print statements in test-cases/libraries because prints statements are not captured in log files. Use logger functions to dump messages into log file.

Logging:

Log file name and Log level can be passed as argument to glusto command while running the glusto-tests. For example:

# glusto -c 'config.yml' -l /tmp/glustotests_bvt.log --log-level DEBUG --pytest='-v -x tests -m bvt'

One can configure log files, log levels in the testcases as well. For details on how to use glusto framework for configuring logs in tests Refer the following docs.

Default log location is: /tmp/glustomain.log

Note: When using glusto via the Python Interactive Interpreter, the default log location is /tmp/glusto.log.

glusto-libs's People

Contributors

akarsha-rai avatar shrivaibavi avatar nigelbabu avatar

Watchers

 avatar Vijay Bellur avatar James Cloos avatar John Strunk avatar  avatar  avatar  avatar

glusto-libs's Issues

libraries yet to be implemented

Description:
When triggered gd1 testcases by using gd2 libraries we identified few gaps in the gd2 libraries.
I hereby list the following libraries needed to be implemented in gd2

  1. peer_detach_servers
    2.peer_probe_servers
    3.is_peer_connected
    4.get_snapshot_info_by_volumename
    5.Brick libs needs to implemented( form_brick_list etc)
    6.snapshot_list_by_volname
    7.volume_exists
    8.setup_volume
    9.cleanup_volume

Note: The libraries implemented till now are under review and we are working to get them merged as soon as possible.

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.