summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkarsha <akrai@redhat.com>2019-03-29 18:06:36 +0530
committerVijay Avuthu <vavuthu@redhat.com>2019-04-02 06:17:57 +0000
commitf2d4e893e8bbb8a399de8405cd6e311a52787aa1 (patch)
tree3d5fc255e664a3cd2750c8e5034f5f2c67dc7935
parentfa967b1e9106849e962f98095740b784e717ca68 (diff)
Modifying existing doc
Change-Id: Ibd0a461c814227a71370b9e5d4bdddd750e1af4e Signed-off-by: Akarsha <akrai@redhat.com>
-rw-r--r--README.md151
1 files changed, 108 insertions, 43 deletions
diff --git a/README.md b/README.md
index 371229e..d9e4537 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,8 @@ The Libraries/Modules/Tests in glusto-tests are written using the `glusto`
framework. TestCases in glusto-tests can we written/run using standard
PyUnit, PyTest or Nose methodologies as supported by `glusto` framework.
-Refer the [glusto-doc](http://glusto.readthedocs.io/en/latest/) for info
-on `glusto` framework.
-Issues need to be filled against the
-[Github](https://github.com/gluster/glusto-tests/issues) repo.
+Refer the [glusto-doc](http://glusto.readthedocs.io/en/latest/) for info on `glusto` framework.
+Issues need to be filled against the [Github](https://github.com/gluster/glusto-tests/issues) repo.
To automate/run glusto-tests we need to install the following packages:
---------------------------------------------------------------------
@@ -24,6 +22,7 @@ To automate/run glusto-tests we need to install the following packages:
How to install glusto:
----------------------
One can use either of the two methods.
+
- using pip
# pip install --upgrade git+git://github.com/loadtheaccumulator/glusto.git
@@ -37,7 +36,7 @@ One can use either of the two methods.
For more info refer the [docs](http://glusto.readthedocs.io/en/latest/userguide/install.html).
How to install the glustolibs-gluster, glustolibs-io and glustolibs-misc libraries:
------------------------------------------------------------------
+----------------------------------------------------------------------------------------------
# git clone http://review.gluster.org/glusto-tests
# cd glusto-tests/glustolibs-gluster
# python setup.py install
@@ -47,62 +46,128 @@ How to install the glustolibs-gluster, glustolibs-io and glustolibs-misc librari
# python setup.py install
How to install gdeploy:
------------------------
+--------------------------------
- Install latest version of gdeploy from the following [link](https://copr.fedorainfracloud.org/coprs/sac/gdeploy/package/gdeploy/).
To install glusto-tests dependencies:
--------------------------------------
-`python-docx` needs to be installed when we run IO's and validates on client node.
+--------------------------------------------------
+- `python-docx` needs to be installed when we run IO's and validates on client node.
+ - To install run :
-To install run :
- # curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
- # python get-pip.py
- # pip install --pre python-docx
+ # curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
+ # python get-pip.py
+ # pip install --pre python-docx
-How to run the test case:
--------------------------
-- Create config file containing info about the servers, clients,
- for example refer [config](https://github.com/gluster/glusto-tests/blob/master/tests/gluster_basic_config.yml),
- this config file is enough to run all test cases. But if you need to override the default values of volumes,
- mount.. etc which is passed in gluster_base_class, can be passed in config
- file[config](https://github.com/gluster/glusto-tests/blob/master/tests/gluster_tests_config.yml).
- Refer the following for more info [link](http://glusto.readthedocs.io/en/latest/userguide/configurable.html).
+- `arequal` needs to be installed on all servers and clients.
+ - To install download the below repo into /etc/yum.repos.d/
-- 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:
+ # wget https://copr.fedorainfracloud.org/coprs/nigelbabu/arequal/repo/epel-7/nigelbabu-arequal-epel-7.repo
+ # yum install arequal
- To run PyUnit tests:
- # glusto -c 'config.yml' -d 'tests'
- # glusto -c 'config.yml unittest_list.yml' -u
+Pre-requisites to run glusto-tests:
+----------------------------------------------
+- Make sure glusto, glusto-tests are installed on the node from where you would want to run the gluster tests.
+- Running Gluster Cluster( 6 Servers and 2 Clients )
+- Gluster client packages should be installed on Clients
+- Setup passwordless ssh from the glusto-tests management node to all.
+- Install glusto-tests dependencies on servers and clients.
+- Setup bricks on all servers:
+ - To create bricks refer to [doc](https://gluster.readthedocs.io/en/latest/Administrator%20Guide/formatting-and-mounting-bricks/)
- To run PyTest tests:
- # glusto -c 'config.yml' --pytest='-v -x tests -m bvt'
+Note:
- To run Nose tests:
- # glusto -c 'config.yml' --nosetests='-v -w tests'
+ - To run cifs protocol:
+ 1.CIFS packages need to be installed on the server
+ 2.Samba services need to be ACTIVE
+ 3.cifs-utils need to be installed on the client
+ - To run nfs protocol, nfs packages must be installed on server and client
- For more info about running these tests, refer the [docs](http://glusto.readthedocs.io/en/latest/userguide/glusto.html#options-for-running-unit-tests).
+ For more info how to run glusto-tests from the scratch including creating OS, server, etc.. refer [link](https://github.com/gluster/glusto-tests/blob/master/docs/userguide/HOWTO)
-- To know how to run glusto-tests from the scratch including creating OS, server, etc.. refer [link](https://github.com/gluster/glusto-tests/blob/master/docs/userguide/HOWTO)
+How to run the test case:
+----------------------------------
+- Update the information about the servers, clients, servers_info, client_info on the [config_file](https://github.com/gluster/glusto-tests/blob/master/tests/gluster_basic_config.yml), this information is enough to run all test cases. But if you need to override the default values of volumes, mount.. etc which is defined in gluster_base_class then use [config](https://github.com/gluster/glusto-tests/blob/master/tests/gluster_tests_config.yml) and update the information accordingly.
+Refer the following for more info [link](http://glusto.readthedocs.io/en/latest/userguide/configurable.html).
-Writing tests in glusto-tests:
-------------------------------
-`tests` directory in glusto-tests contains testcases. One might want to create
-a dir with feature name as the name of test directory under `tests` to add
-new testcases. Testcases name should start with`test_`
+- 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: PyUnit Tests, PyTest Tests, Nose Tests.
+The most common used is Pytest.
+ - **Running PyTest Tests**
+ - To run all tests that are marked with tag 'bvt':
-TestCases in glusto-tests can we written using standard PyUnit, PyTest or Nose
-methodologies as supported by `glusto` framework.
+ # glusto -c config.yml --pytest='-v -x tests -m bvt'
+ - To run all tests that are under bvt folder:
-One can follow the [PyUnit](http://glusto.readthedocs.io/en/latest/userguide/unittest.html) docs to write PyUnit tests,
-or [PyTest](http://glusto.readthedocs.io/en/latest/userguide/pytest.html) docs to write PyTest tests,
-or [Nose](http://glusto.readthedocs.io/en/latest/userguide/nosetests.html) docs to write Nose tests.
+ # 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 tests on PyUnit, Pytest and Nose Tests, refer the [docs](http://glusto.readthedocs.io/en/latest/userguide/glusto.html#options-for-running-unit-tests).
+
+Writing tests in glusto-tests:
+----------------------------------
+- `tests` directory in glusto-tests contain testcases. Testcases are written as component wise.
+Testcases name and file name should should start with **test_**.
+
+- TestCases in glusto-tests can be written using standard PyUnit, PyTest or Nose methodologies as supported by `glusto` framework.
+ - One can follow the [PyUnit](http://glusto.readthedocs.io/en/latest/userguide/unittest.html) docs to write PyUnit tests, or [PyTest](http://glusto.readthedocs.io/en/latest/userguide/pytest.html) docs to write PyTest tests, or [Nose](http://glusto.readthedocs.io/en/latest/userguide/nosetests.html) docs to write Nose tests.
+
+**While writing testcases or libraries follow:**
+
+- Please follow the [PEP008 style-guide](https://www.python.org/dev/peps/pep-0008/).
+- 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](https://docs.pylint.org/en/1.6.0/tutorial.html) and on [pyflakes](http://flake8.pycqa.org/en/latest/index.html).
+ We can check for pyflakes and pylint errors:
+ ```
+ # flake8 <test_script.py>
+ or
+ # flake8 <path_to_directory>
+ # pylint -j 4 --rcfile=/glusto-tests/.pylintrc <test_script.py>
+ ```
+- 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](http://google.github.io/styleguide/pyguide.html).
+- 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:
+ ```
+ def test_peer_status(self):
+ # 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.
For more info how to write testcases [developing-guide](https://github.com/gluster/glusto-tests/blob/master/docs/userguide/developer-guide.rst)
Logging:
---------
+--------------
Log file name and Log level can be passed as argument to glusto command while
running the glusto-tests. For example: