Debian Codegraph @

tests/README

raw
1 SaunaFS functional tests
2 *************************
3
4
5 How to configure testing environment?
6 =====================================
7
8 Functional tests configure and run testing SaunaFS installation several times.
9 Test installation runs all system modules on a single computer.
10 To prepare the testing environment safely, please use the following script:
11
12 <SOURCE_DIRECTORY>/tests/setup_machine.sh
13
14 You will need root permissions to use it. When running it, you may want to provide
15 directories which will be used by chunkservers during the tests to store any
16 generated data as arguments for this script, eg:
17
18 sudo setup_machine.sh setup /mnt/hdb /mnt/hdc /mnt/hdd /mnt/hde
19
20 These directories may be located on one physical disk. Long tests, however, may not work
21 in such configuration (they generate heavy traffic). It's OK for sanity checks.
22 There should be about 60 GB of disk space available for the tests.
23 At least three directories have to be provided in order to run some of the test cases.
24 Remember that user 'saunafstest' needs permissions to write files in these
25 directories. All the contents of these directories will be erased during tests.
26
27 If you want to know what 'setup_machine.sh' does, just run it without any command line
28 arguments. It will print a short description of all the changes it is going to make.
29
30 The tests need to know which binaries should be tested. The default location is
31 /var/lib/saunafstest/local and this means eg. that the master server will run code
32 from the /var/lib/saunafstest/local/sbin/sfsmaster file. You can change this
33 default directory by adding an entry like this to /etc/saunafs_tests.conf file:
34
35 : ${SAUNAFS_ROOT:=/home/you/local}
36
37 Make sure that the user saunafstest is able to read files from this directory.
38
39 How to compile the tests?
40 =========================
41
42 To use tests, SaunaFS has to be compiled with an option ENABLE_TESTS, e.g.:
43
44 cmake .. -DENABLE_TESTS=YES
45
46 Test installation has to be prepared. Default location for tests is
47 '$HOME/local' but it can be changed in tests config file, e.g.:
48
49 : ${SAUNAFS_ROOT:="$HOME/SaunaFS"}
50
51 After that, the tests are ready to be run.
52
53 How to launch the tests?
54 ========================
55
56 The testing framework configuration is read from one of multiple possible sources,
57 either:
58 - /etc/saunafs_tests.conf
59 - ${HOME}/etc/saunafs/tests.conf
60 - ${SAUNAFS_TESTS_CONF}
61
62 Test binary is installed together with the file system. The path leading to it
63 is the following:
64
65 <INSTALL_PREFIX>/bin/saunafs-tests
66
67 Alternatively, it can be run from build directory:
68
69 <SOURCE_DIRECTORY>/tests/saunafs-tests
70
71 This binary runs all the bash scripts using googletest framework. This makes
72 it easy to generate a report after all the tests are finished. Part of the source code
73 of 'saunafs-tests' binary (list of tests) is generated automatically when tests are added
74 or removed. Launched without any parameters, it executes all available tests.
75 By using a parameter '--gtest_filter' you can choose which tests are to be run.
76 The above parameter uses a pattern to select the tests, e.g.:
77
78 ./saunafs-tests --gtest_filter='SanityChecks*'
79
80 The command above runs all tests from 'SanityChecks' suite.
81 A 'saunafs-tests' binary uses an interface delivered by googletest which is displayed after:
82
83 ./saunafs-tests --help
84
85
86 How to make your own test?
87 ==========================
88
89 To create a new test simply create a file:
90
91 <SOURCE_DIRECTORY>/tests/test_suites/<SUITE>/test_<TEST_NAME>.sh
92
93 where:
94 <SUITE> is a test suite that you want your test to be a part of.
95 Existing test suites:
96 - SanityChecks – basic tests of SaunaFS functionality; these tests
97 should last a couple of minutes,
98 - ShortSystemTests – advanced tests of SaunaFS functionality not requiring
99 dedicated storage; these tests last around half an hour,
100 - LongSystemTests – advanced tests of SaunaFS functionality requiring
101 dedicated storage; these tests last a few hours,
102 - ContinuousTests – tests using SaunaFS mountpoint to populate SaunaFS
103 installation with data and validate them;
104 these tests are desigend to be run continuously,
105 <TEST_NAME> is a name of your test.
106
107 Tests which you write are run inside a kind of sandbox. They use UID
108 of a special user 'saunafstest', so you can safely spawn any processes
109 (they will be killed after the test).
110 Our testing framework provides numerous bash functions and structures. They are
111 implemented in the following directory:
112
113 <SOURCE_DIRECTORY>/tests/tools
114
115 Merry testing!