Giter VIP home page Giter VIP logo

glusterfs-containers-tests's Introduction

Openshift Storage Tests

This repo contains test cases and functions for storage on OpenShift. The functions can be installed as python package and used in any other python project.

Getting started

Prerequisites

Create setup with below system requirements and install required packages on host from which this repo is used as library or tests are executed.

System Requirements

  • 1 Master node

  • 3 Storage nodes

  • Passwordless ssh from the host (machine from where the tests would be run) to all the nodes in the cluster

  • Each node in the trusted storage pool should have 2 mandatory and 1 optional devices

    1. Device 1 (part of the topology)
    2. Device 2 (part of the topology)
    3. Device 3 (Optional additional device not part of the topology)

Installing tox on host

tox aims to automate and standardize testing in Python. It is generic virtualenv management and test command line tool you can use for

  • Checking your package installs correctly with different Python versions and interpreters
  • Running your tests in each of the environments, configuring your test tool of choice
  • Acting as frontend to Continuous integration servers, greatly reducing boilerplates and merging CI and shell-based testing

Refer tox doc for more information.

Below are the instructions to install tox on host

  • Install below system packages

    $ yum install python-pip git gcc python-devel
    
  • Install tox package

    $ pip install git+git://github.com/tox-dev/[email protected]#egg=tox
    

Executing the test cases

  • Create a config file which lists out the OCP configurations like master and storage node details, heketi related configurations etc. Sample config file can be found under tests directory

    $ tests/glusterfs-containers-tests-config.yaml
    
  • To run test cases in a virtual environment using py2:

    $ tox -e functional -- glusto -c <config_file> \
        '--pytest=-v -rsx <test_file_path_or_dir>'
    
    For example:
    • Execute single test case from test class file
    $ tox -e functional -- glusto -c \
        tests/glusterfs-containers-tests-config.yaml \
        '--pytest=-v -rsx \
        tests/functional/arbiter/test_arbiter.py \
        -k test_arbiter_pvc_create'
    
    • Execute all test cases from test class file
    $ tox -e functional -- glusto -c \
        tests/glusterfs-containers-tests-config.yaml \
        '--pytest=-v -rsx
        tests/functional/arbiter/test_arbiter.py'
    
    • Execute all test cases from test directory
    $ tox -e functional -- glusto -c \
        tests/glusterfs-containers-tests-config.yaml \
        '--pytest=-v -rsx tests'
    
  • To run test cases in a virtual environment using py3:

    $ python3 -m tox -e functional3 -- glusto -c <config_file> \
        '--pytest=-v -rsx <test_file_path_or_dir>'
    

    Note, that "tox" and other python packages should be installed using pip3 - separate package installer than the one used for py2 (pip).

Writing tests in glusterfs-containers-tests

tests directory in glusterfs-containers-tests contains test cases. One might want to create a directory with feature name as the name of test directory under tests to add new test cases.

Similar to glusto-tests, test cases in glusterfs-containers-tests can be written using standard PyUnit, PyTest or Nose methodologies as supported by glusto framework.

One can follow the PyUnit docs to write PyUnit tests, or PyTest docs to write PyTest tests, or Nose docs to write Nose tests.

For more information on how to write test cases, refer developing-guide.

Validating PEP 8 rules after adding new code

Refer PEP 8 -- Style Guide for Python Code for more information on PEP 8 rules.

  • Run PEP 8 checks for all files

    $ tox -e pep8
    
  • Run PEP 8 check for single file

     $ tox -e pep8 <absolute_or_relative_file_path>
    
    For Example:
    
     .. code-block::
    
          $ tox -e pep8 tests/functional/test_heketi_restart.py
    

Logging

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

For example:

$ tox -e functional -- glusto -c 'config.yml' \
    -l /tmp/glustotests-ocp.log --log-level DEBUG \
    '--pytest=-v -x tests -m ocp'

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

Default log location is /tmp/glustomain.log

Note

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

glusterfs-containers-tests's People

Contributors

vponomaryov avatar vamahaja avatar iamniting avatar aanand01762 avatar srivickynesh avatar sushilg96 avatar apekhsha avatar keesturam avatar adityaramteke avatar kasturinarra avatar aloganat avatar rachael-george avatar crombus avatar phlogistonjohn avatar balakreddy avatar upasanabansal avatar kshithijiyer avatar madhu-1 avatar sayaleeraut avatar akarsha-rai avatar msainiredhat avatar obnoxxx avatar saravanastoragenetwork avatar

Stargazers

 avatar

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.