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