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