1 ## Common test scripts and env file for test
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.
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.
9 **testsuite_common.sh**: Common functions for auto test suites in the auto-test dir.
11 ## Descriptions of functions in testcase_common.sh
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.
16 Print the env variables needed for the simulators and their setup
19 Stop and remove all containers including dfc apps and simulators
22 Start all simulators in the simulator group
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'.
28 **kill_dfc \<dfc-instance-id>**:
29 Stop and remove the dfc app container with the instance id.
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.
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.
40 Stop and remove the DR simulator container
43 Stop and remove the DR redir simulator container
46 Stop and remove the MR simulator container
48 **kill_sftp \<sftp-instance-id>**:
49 Stop and remove a SFTP container with the supplied instance id (0-5).
51 **stop_sftp \<sftp-instance-id>**:
52 Stop a SFTP container with the supplied instance id (0-5).
54 **start_sftp \<sftp-instance-id>**:
55 Start a previously stopped SFTP container with the supplied instance id (0-5).
57 **kill_ftpes \<ftpes-instance-id>**:
58 Stop and remove a FTPES container with the supplied instance id (0-5).
60 **stop_ftpes \<ftpes-instance-id>**:
61 Stop a FTPES container with the supplied instance id (0-5).
63 **start_ftpes \<ftpes-instance-id>**:
64 Start a previously stopped FTPES container with the supplied instance id (0-5).
66 **kill_http \<http-instance-id>**:
67 Stop and remove a HTTP container with the supplied instance id (0-5).
69 **stop_http \<http-instance-id>**:
70 Stop a HTTP container with the supplied instance id (0-5).
72 **start_http \<http-instance-id>**:
73 Start a previously stopped HTTP container with the supplied instance id (0-5).
75 **mr_print \<variable-name>**:
76 Print a variable value from the MR simulator.
78 **dr_print \<variable-name>**:
79 Print a variable value from the DR simulator.
81 **drr_print \<variable-name>**:
82 Print a variable value from the DR redir simulator.
84 **dfc_print \<dfc-instance-id> <variable-name>**:
85 Print a variable value from an dfc instance with the supplied instance id (0-5).
87 **mr_read \<variable-name>**:
88 Read a variable value from MR sim and send to stdout
90 **dr_read \<variable-name>**:
91 Read a variable value from DR sim and send to stdout
93 **drr_read \<variable-name>**:
94 Read a variable value from DR redir sim and send to stdout
96 **sleep_wait \<sleep-time-in-sec>**:
97 Sleep for a number of seconds
99 **sleep_heartbeat \<sleep-time-in-sec>**:
100 Sleep for a number of seconds and prints dfc heartbeat output every 30 sec
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
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
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
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
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
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
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
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
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
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
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
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
198 **dfc_contain_str \<variable-name> \<substring-in-quotes>**:
199 Test if a variable in the DFC contains a substring.
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.
208 Check the dfc application log for WARN and ERR messages and print the count.
211 Print the test result. Only once at the very end of the script.
214 Print all variables from the simulators and the dfc heartbeat.
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>"`.
219 ## Descriptions of functions in testsuite_common.sh
221 The following is a list of the available functions in a test suite file. Please see a existing test suite for examples.
224 Sets up the test suite and print out a heading.
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
230 Print out the overall result of the executed test cases.