Project: Gluster (Runtime / Cloud Native Storage)
File: Using-Gluster-Test-Framework.md

Description -- The Gluster Test Framework, is a suite of scripts used for regression testing of Gluster. It runs well on RHEL, CentOS, and Fedora, and is run on a request basis against the patches submitted to Gluster . The Gluster Test Framework is part of the main Gluster code base, living under the "tests" subdirectory: https://github.com/gluster/glusterfs WARNING Running the Gluster Test Framework deletes /var/lib/glusterd/\*. DO NOT run it on a server with any data. Preparation steps for Ubuntu 14.04 LTS -- \# apt-get install dbench git libacl1-dev mock nfs-common nfs-kernel-server libtest-harness-perl libyajl-dev xfsprogs psmisc attr acl lvm2 rpm \# apt-get install python-webob python-paste python-sphinx \# apt-get install autoconf automake bison dos2unix flex libfuse-dev libaio-dev libibverbs-dev librdmacm-dev libtool libxml2-dev libxml2-utils liblvm2-dev make libssl-dev pkg-config libpython-dev python-eventlet python-netifaces python-simplejson python-pyxattr libreadline-dev tar 4) Install cmockery2 from github (https://github.com/lpabon/cmockery2) and compile and make install as in Readme 5) sudogroupaddmock sudouseradd-gmockmock 6) mkdir /var/run/gluster Note: redhat-rpm-config package is not found in ubuntu Preparation steps for CentOS 7 (only) Install EPEL: $sudoyuminstall-yhttp://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-1.noarch.rpm Install the CentOS 7.x dependencies: $sudoyuminstall-y--enablerepo=epelcmockery2-develdbenchgitlibacl-develmocknfs-utilsperl-Test-Harnessyajlxfsprogspsmisc $sudoyuminstall-y--enablerepo=epelpython-webob1.0python-paste-deploy1.5python-sphinx10redhat-rpm-config ==\> Despite below missing packages it worked for me Nopackagepython-webob1.0available. Nopackagepython-paste-deploy1.5available. Nopackagepython-sphinx10available. $sudoyuminstall-y--enablerepo=epelautoconfautomakebisondos2unixflexfuse-devellibaio-devellibibverbs-devel\ librdmacm-devellibtoollibxml2-devellvm2-develmakeopenssl-develpkgconfig\ python-develpython-eventletpython-netifacespython-paste-deploy\ python-simplejsonpython-sphinxpython-webobpyxattrreadline-develrpm-build\ tar Create the mock user $sudouseradd-gmockmock Preparation steps for CentOS 6.3+ (only) Install EPEL: $sudoyuminstall-yhttp://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Install the CentOS 6.x dependencies: $sudoyuminstall-y--enablerepo=epelcmockery2-develdbenchgitlibacl-develmocknfs-utilsperl-Test-Harnessyajlxfsprogs $sudoyuminstall-y--enablerepo=epelpython-webob1.0python-paste-deploy1.5python-sphinx10redhat-rpm-config $sudoyuminstall-y--enablerepo=epelautoconfautomakebisondos2unixflexfuse-devellibaio-devellibibverbs-devel\ librdmacm-devellibtoollibxml2-devellvm2-develmakeopenssl-develpkgconfig\ python-develpython-eventletpython-netifacespython-paste-deploy\ python-simplejsonpython-sphinxpython-webobpyxattrreadline-develrpm-build\ tar Create the mock user $sudouseradd-gmockmock Preparation steps for RHEL 6.3+ (only) -- Ensure you have the "Scalable Filesystem Support" group installed This provides the xfsprogs package, which is required by the test framework. Install EPEL: $sudoyuminstall-yhttp://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Install the CentOS 6.x dependencies: $sudoyuminstall-y--enablerepo=epelcmockery2-develdbenchgitlibacl-develmocknfs-utilsyajlperl-Test-Harness $sudoyuminstall-y--enablerepo=rhel-6-server-optional-rpmspython-webob1.0python-paste-deploy1.5python-sphinx10redhat-rpm-config $sudoyuminstall-y--disablerepo=rhs--enablerepo=optional-rpmsautoconf\ automakebisondos2unixflexfuse-devellibaio-devellibibverbs-devel\ librdmacm-devellibtoollibxml2-devellvm2-develmakeopenssl-develpkgconfig\ python-develpython-eventletpython-netifacespython-paste-deploy\ python-simplejsonpython-sphinxpython-webobpyxattrreadline-develrpm-build\ tar Create the mock user $sudouseradd-gmockmock Preparation steps for Fedora 16-19 (only) -- Still in development Install the Fedora dependencies: $sudoyuminstall-yattrcmockery2-develdbenchgitmocknfs-utilsperl-Test-Harnesspsmiscxfsprogs $sudoyuminstall-ypython-webob1.0python-paste-deploy1.5python-sphinx10redhat-rpm-config $sudoyuminstall-yautoconfautomakebisondos2unixflexfuse-devellibaio-devellibibverbs-devel\ librdmacm-devellibtoollibxml2-devellvm2-develmakeopenssl-develpkgconfig\ python-develpython-eventletpython-netifacespython-paste-deploy\ python-simplejsonpython-sphinxpython-webobpyxattrreadline-develrpm-build\ tar Create the mock user $sudouseradd-gmockmock Common steps Ensure DNS for your server is working The Gluster Test Framework fails miserably if the full domain name for your server doesn't resolve back to itself. If you don't have a working DNS infrastructure in place, adding an entry for your server to its /etc/hosts file will work. Install the version of Gluster you are testing Either install an existing set of rpms: $sudoyuminstall[yourglusterrpmshere] Or compile your own ones (fairly easy): https://docs.gluster.org/en/latest/Developer-guide/compiling-rpms/ Clone the GlusterFS git repository $gitclonegit://git.gluster.org/glusterfs $cdglusterfs Ensure mock can access the directory Some tests run as the user

If the mock user can't access the tests subdirectory directory, these tests fail. (rpm.t is one such test) This is a known gotcha when the git repo is cloned to your home directory. Home directories generally don't have world readable permissions. You can fix this by adjusting your home directory permissions, or placing the git repo somewhere else (with access for the mock user). Running the tests -- The tests need to run as root, so they can mount volumes and manage gluster processes as needed. It's also best to run them directly as the root user, instead of through sudo. Strange things sporadicly happen (for me) when using the full test framework through sudo, that haven't happened (yet) when running directly as root. Hangs in dbench particularly, which are part of at least one test. The test framework takes just over 45 minutes to run in a VM here (4 cpu's assigned, 8GB ram, SSD storage). It may take significantly more or less time for you, depending on the hardware and software you're using. Showing debug information To display verbose information while the tests are running, set the DEBUG environment variable to 1 prior to running the tests. Log files Verbose output from the rpm.t test goes into "rpmbuild-mock.log", located in the same directory the test is run from. Reporting bugs -- If you hit a bug when running the test framework, please create a bug report for it on github so it gets fixed: https://github.com/gluster/glusterfs/issues/new Creating your own tests -- The test scripts are written in bash, with their filenames ending in .t instead of .sh. When creating your own test scripts, create them in an appropriate subdirectory under "tests" (eg "bugs" or "features") and use descriptive names like "bug-XXXXXXX-checking-feature-X.t" Also include the "include.rc" file, which defines the test types and host/brick/volume defaults: .$(dirname$0)/../include.rc There are 5 test types available at present, but feel free to add more if you need something that doesn't yet exist. The test types are explained in more detail below. Also essential is the "cleanup" command, which removes any existing Gluster configuration (without backing it up), and also kills any running gluster processes. There is a basic test template you can copy, named bug-000000.t in the bugs subdirectory: $cpbugs/bug-000000.tsomedir/descriptive-name.t Example of usage in basic/volume.t Example of usage in basic/rpm.t Example of usage in basic/volume.t Example of usage in basic/volume-status.t Defined in include.rc, but seems to be unused?