SaunaFS functional tests ************************* How to configure testing environment? ===================================== Functional tests configure and run testing SaunaFS installation several times. Test installation runs all system modules on a single computer. To prepare the testing environment safely, please use the following script: /tests/setup_machine.sh You will need root permissions to use it. When running it, you may want to provide directories which will be used by chunkservers during the tests to store any generated data as arguments for this script, eg: sudo setup_machine.sh setup /mnt/hdb /mnt/hdc /mnt/hdd /mnt/hde These directories may be located on one physical disk. Long tests, however, may not work in such configuration (they generate heavy traffic). It's OK for sanity checks. There should be about 60 GB of disk space available for the tests. At least three directories have to be provided in order to run some of the test cases. Remember that user 'saunafstest' needs permissions to write files in these directories. All the contents of these directories will be erased during tests. If you want to know what 'setup_machine.sh' does, just run it without any command line arguments. It will print a short description of all the changes it is going to make. The tests need to know which binaries should be tested. The default location is /var/lib/saunafstest/local and this means eg. that the master server will run code from the /var/lib/saunafstest/local/sbin/sfsmaster file. You can change this default directory by adding an entry like this to /etc/saunafs_tests.conf file: : ${SAUNAFS_ROOT:=/home/you/local} Make sure that the user saunafstest is able to read files from this directory. How to compile the tests? ========================= To use tests, SaunaFS has to be compiled with an option ENABLE_TESTS, e.g.: cmake .. -DENABLE_TESTS=YES Test installation has to be prepared. Default location for tests is '$HOME/local' but it can be changed in tests config file, e.g.: : ${SAUNAFS_ROOT:="$HOME/SaunaFS"} After that, the tests are ready to be run. How to launch the tests? ======================== The testing framework configuration is read from one of multiple possible sources, either: - /etc/saunafs_tests.conf - ${HOME}/etc/saunafs/tests.conf - ${SAUNAFS_TESTS_CONF} Test binary is installed together with the file system. The path leading to it is the following: /bin/saunafs-tests Alternatively, it can be run from build directory: /tests/saunafs-tests This binary runs all the bash scripts using googletest framework. This makes it easy to generate a report after all the tests are finished. Part of the source code of 'saunafs-tests' binary (list of tests) is generated automatically when tests are added or removed. Launched without any parameters, it executes all available tests. By using a parameter '--gtest_filter' you can choose which tests are to be run. The above parameter uses a pattern to select the tests, e.g.: ./saunafs-tests --gtest_filter='SanityChecks*' The command above runs all tests from 'SanityChecks' suite. A 'saunafs-tests' binary uses an interface delivered by googletest which is displayed after: ./saunafs-tests --help How to make your own test? ========================== To create a new test simply create a file: /tests/test_suites//test_.sh where: is a test suite that you want your test to be a part of. Existing test suites: - SanityChecks – basic tests of SaunaFS functionality; these tests should last a couple of minutes, - ShortSystemTests – advanced tests of SaunaFS functionality not requiring dedicated storage; these tests last around half an hour, - LongSystemTests – advanced tests of SaunaFS functionality requiring dedicated storage; these tests last a few hours, - ContinuousTests – tests using SaunaFS mountpoint to populate SaunaFS installation with data and validate them; these tests are desigend to be run continuously, is a name of your test. Tests which you write are run inside a kind of sandbox. They use UID of a special user 'saunafstest', so you can safely spawn any processes (they will be killed after the test). Our testing framework provides numerous bash functions and structures. They are implemented in the following directory: /tests/tools Merry testing!