Fix integration markdown errors for linter
[integration.git] / test / mocks / datafilecollector-testharness / common / README.md
1 ## Common test scripts and env file for test
2
3 **test_env.sh**</br>
4 Common env variables for test in the auto-test dir. Used by the auto test cases/suites but could be used for other test script as well.
5
6 **testcase_common.sh**</br>
7 Common functions for auto test cases in the auto-test dir. A subset of the functions could be used in other test scripts as well.
8
9 **testsuite_common.sh**</br>
10 Common functions for auto test suites in the auto-test dir.
11
12 ## Descriptions of functions in testcase_common.sh
13
14 The following is a list of the available functions in a test case file. Please see some of the defined test cases for examples.
15
16 **log_sim_settings**</br>
17 Print the env variables needed for the simulators and their setup
18
19 **clean_containers**</br>
20 Stop and remove all containers including dfc apps and simulators
21
22 **start_simulators**</br>
23 Start all simulators in the simulator group
24
25 **start_dfc <dfc-instance-id>**</br>
26 Start the dfc application. The arg shall be an integer from 0 to 5 representing the dfc instance to start. DFC app will get a name like 'dfc_app0' to 'dfc_app4'.
27
28 **kill_dfc  <dfc-instance-id> **</br>
29 Stop and remove the dfc app container with the instance id.
30
31 **consul_config_app <dfc-instance-id> <json-file-path>**</br>
32 Configure consul with json file with app config for a dfc instance using the dfc instance id and the json file.
33
34 **consul_config_dmaap <dfc-instance-id> <json-file-path>**</br>
35 Configure consul with json file with dmaap config for a dfc instance using the dfc instance id and the json file.
36
37 **kill_dr**</br>
38 Stop and remove the DR simulator container
39
40 **kill_drr**</br>
41 Stop and remove the DR redir simulator container
42
43 **kill_mr**</br>
44 Stop and remove the MR simulator container
45
46 **kill_sftp <sftp-instance-id>**</br>
47 Stop and remove a SFTP container with the supplied instance id (0-5).
48
49 **stop_sftp <sftp-instance-id>**</br>
50 Stop a SFTP container with the supplied instance id (0-5).
51
52 **start_sftp <sftp-instance-id>**</br>
53 Start a previously stopped SFTP container with the supplied instance id (0-5).
54
55 **kill_ftps <ftps-instance-id>**</br>
56 Stop and remove a FTPS container with the supplied instance id (0-5).
57
58 **stop_ftps <ftps-instance-id>**</br>
59 Stop a FTPS container with the supplied instance id (0-5).
60
61 **start_ftps <ftps-instance-id>**</br>
62 Start a previously stopped FTPS container with the supplied instance id (0-5).
63
64 **mr_print <vaiable-name>**</br>
65 Print a variable value from the MR simulator.
66
67 **dr_print <vaiable-name>**</br>
68 Print a variable value from the DR simulator.
69
70 **drr_print <vaiable-name>**</br>
71 Print a variable value from the DR redir simulator.
72
73 **dfc_print <dfc-instance-id> <vaiable-name>**</br>
74 Print a variable value from an dfc instance with the supplied instance id (0-5).
75
76 **mr_read <vaiable-name>**</br>
77 Read a variable value from MR sim and send to stdout
78
79 **dr_read <vaiable-name>**</br>
80 Read a variable value from DR sim and send to stdout
81
82 **drr_read <vaiable-name>**</br>
83 Read a variable value from DR redir sim and send to stdout
84
85 **sleep_wait <sleep-time-in-sec>**</br>
86 Sleep for a number of seconds
87
88 **sleep_heartbeat <sleep-time-in-sec>**</br>
89 Sleep for a number of seconds and prints dfc heartbeat output every 30 sec
90
91 **mr_equal <variable-name> <target-value> [<timeout-in-sec>]**</br>
92 Tests if a variable value in the MR simulator is equal to a target value and an optional timeout.
93 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
94 equal to the targer or not.
95 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
96 before setting pass or fail depending on if the variable value becomes equal to the target
97 value or not.
98
99 **mr_greater <variable-name> <target-value> [<timeout-in-sec>]**</br>
100 Tests if a variable value in the MR simulator is greater than a target value and an optional timeout.
101 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
102 greater the target or not.
103 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
104 before setting pass or fail depending on if the variable value is greater than the target
105 value or not.
106
107 **mr_less <variable-name> <target-value> [<timeout-in-sec>]**</br>
108 Tests if a variable value in the MR simulator is less than a target value and an optional timeout.
109 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
110 less than the target or not.
111 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
112 before setting pass or fail depending on if the variable value is less than the target
113 value or not.
114
115 **mr_contain_str <variable-name> <target-value> [<timeout-in-sec>]**</br>
116 Tests if a variable value in the MR simulator contains a substring target and an optional timeout.
117 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable contains
118 the target substring or not.
119 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
120 before setting pass or fail depending on if the variable value contains the target
121 substring or not.
122
123 **dr_equal <variable-name> <target-value> [<timeout-in-sec>]**</br>
124 Tests if a variable value in the DR simulator is equal to a target value and an optional timeout.
125 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
126 equal to the target or not.
127 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
128 before setting pass or fail depending on if the variable value becomes equal to the target
129 value or not.
130
131 **dr_greater <variable-name> <target-value> [<timeout-in-sec>]**</br>
132 Tests if a variable value in the DR simulator is greater than a target value and an optional timeout.
133 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
134 greater the target or not.
135 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
136 before setting pass or fail depending on if the variable value is greater than the target
137 value or not.
138
139 **dr_less <variable-name> <target-value> [<timeout-in-sec>]**</br>
140 Tests if a variable value in the DR simulator is less than a target value and an optional timeout.
141 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
142 less than the target or not.
143 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
144 before setting pass or fail depending on if the variable value is less than the target
145 value or not.
146
147 **dr_contain_str <variable-name> <target-value> [<timeout-in-sec>]**</br>
148 Tests if a variable value in the DR simulator contains a substring target and an optional timeout.
149 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable contains
150 the target substring or not.
151 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
152 before setting pass or fail depending on if the variable value contains the target
153 substring or not.
154
155 **drr_equal <variable-name> <target-value> [<timeout-in-sec>]**</br>
156 Tests if a variable value in the DR Redir simulator is equal to a target value and an optional timeout.
157 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
158 equal to the target or not.
159 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
160 before setting pass or fail depending on if the variable value becomes equal to the target
161 value or not.
162
163 **drr_greater <variable-name> <target-value> [<timeout-in-sec>]**</br>
164 Tests if a variable value in the DR Redir simulator is greater than a target value and an optional timeout.
165 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
166 greater the target or not.
167 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
168 before setting pass or fail depending on if the variable value is greater than the target
169 value or not.
170
171 **drr_less <variable-name> <target-value> [<timeout-in-sec>]**</br>
172 Tests if a variable value in the DR Redir simulator is less than a target value and an optional timeout.
173 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable is
174 less than the target or not.
175 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
176 before setting pass or fail depending on if the variable value is less than the target
177 value or not.
178
179 **drr_contain_str <variable-name> <target-value> [<timeout-in-sec>]**</br>
180 Tests if a variable value in the DR Redir simulator contains a substring target and an optional timeout.
181 </br>Arg: `<variable-name> <target-value>` - This test set pass or fail depending on if the variable contains
182 the target substring or not.
183 </br>Arg: `<variable-name> <target-value> <timeout-in-sec>`  - This test waits up to the timeout seconds
184 before setting pass or fail depending on if the variable value contains the target
185 substring or not.
186
187 **dfc_contain_str <variable-name> <substring-in-quotes>**</br>
188 Test if a variable in the DFC contains a substring.
189
190 **store_logs <log-prefix>**</br>
191 Store all dfc app and simulators log to the test case log dir. All logs get a prefix to
192 separate logs stored at different steps in the test script.
193 If logs need to be stored in several locations, use different prefix to easily identify the location
194 when the logs where taken.
195
196 **check_dfc_log**</br>
197 Check the dfc application log for WARN and ERR messages and print the count.
198
199 **print_result**</br>
200 Print the test result. Only once at the very end of the script.
201
202 **print_all**</br>
203 Print all variables from the simulators and the dfc heartbeat.
204
205 In addition, comment in the file can be added using the normal comment sign in bash '#'.
206 Comments that shall be visible on the screen as well as in the test case log, use `echo "<msg>"`.
207
208 ## Descriptions of functions in testsuite_common.sh
209
210 The following is a list of the available functions in a test suite file.  Please see a existing test suite for examples.
211
212 **suite_setup**</br>
213 Sets up the test suite and print out a heading.
214
215 **run_tc <tc-script> &lt;$1 from test suite script> &lt;$2 from test suite script>**</br>
216 Execute a test case with arg from test suite script
217
218 **suite_complete**</br>
219 Print out the overall result of the executed test cases.