30cf27b499cc1eb74b20c7a7c85ea05d4f9090a8
[nonrtric.git] / test / auto-test / README.md
1 # Overview
2
3 The bash scripts in this dir are intended for function test of the Non-RT RIC in different configurations, using simulators when needed for the external interfaces.
4 A few of the bash scripts are so called 'suites', These suite scripts calls a sequence of the other bash test scripts.
5
6 ## Automated test scripts
7
8 There are two types of scripts, filenames in the format FTCXXX.sh test one or more components of the Non-RT RIC. Filenames in the format SuiteZZZZ.sh tests a number of FTCXXX.sh script as one suite. (XXX is an integer selected from the categories described further below).
9 FTC is short for Function Test Case. In addition, there are also other test scripts with other naming format used for demo setup etc (e.g PM_DEMO.sh).
10
11 To list all test case files with a s short description, do `grep TC_ONELINE_DESCR *.sh` for a complete list.
12
13 The requirements, in terms of the execution environment, to run a script or a suite is to have docker, docker-compose and python3 installed (the scripts warns if not installed). As an option, the scripts can also be executed in a Minikube or Kubernetes installation. The additional requirement is to have a clean minikube/kubernetes installation, preferably with the kube dashboard installed.
14 The scripts have been tested to work on both MacOS and Ubuntu using docker. They should work also in git-bash on windows (for docker) but only partly verified. Running using minikube has only been verified on Ubuntu and running on kubernetes has been verified on MacOS and Ubuntu. Successful sample tests has been made on google cloud.
15
16 ## Configuration
17
18 The test scripts uses configuration from a single profile file, found in `../common/test_env-*.sh`, which contains all needed configuration in terms of image names, image tags, ports, file paths, passwords etc. There is one profile file for system (ORAN/ONAP) and release.
19 If temporary changes are needed to the settings in a profile file, use an override file containing only the variable to override.
20
21 ## How to run
22
23 A test script, for example FTC1, is executed from the cmd line using the script filename and one or more parameters:
24
25  >```./FTC1.sh remote docker --env-file ../common/test_env-oran-h-release.sh```
26
27 Note that this script will use the staging images. Once the release images are available,add the parameter "release" to run with released images.
28
29 See the README.md in  `../common/` for all details about available parameters and their meaning.
30
31 Each test script prints out the overall result of the tests in the end of the execution.
32
33 The test scripts produce quite a number of logs; all container logs, a log of all http/https calls from the test scripts including the payload, some configuration created during test and also a test case log (same as what is printed on the screen during execution). All these logs are stored in `logs/FTCXXX/` - basically in a dir with the same name as the script. So each test script is using its own log directory. If the same test is started again, any existing logs will be moved to a subdirectory called `previous`.
34
35 To test all components on a very basic level, run the demo test script(s) for the desired release.
36 Note that oran tests only include components from oran (exception is the onap sdnc).
37 Note that onap test uses components from onap combined with released oran components available at that onap release (e.g. London contains onap images from London and oran images (released images from g-release).
38
39 In general, the test scripts support the current ongoing release as well as two previous releases.
40
41
42
43 ORAN F-RELEASE
44 =========
45 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-oran-f-release.sh  --use-release-image SDNC```
46
47 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-oran-f-release.sh  --use-release-image SDNC```
48
49 ORAN G-RELEASE
50 =========
51 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-oran-g-release.sh  --use-release-image SDNC```
52
53 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-oran-g-release.sh  --use-release-image SDNC```
54
55 ORAN H-RELEASE - current on master (april 2023)
56 =========
57 >```./PM_EI_DEMO.sh remote-remove  docker  --env-file ../common/test_env-oran-h-release.sh```
58
59 >```./PM_EI_DEMO.sh remote-remove  kube  --env-file ../common/test_env-oran-h-release.sh```
60
61
62 ONAP JAKARTA
63 =============
64 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-onap-jakarta.sh```
65
66 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-onap-jakarta.sh```
67
68
69 ONAP KOHN
70 =============
71 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-onap-kohn.sh```
72
73 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-onap-kohn.sh```
74
75
76 ONAP LONDON - current on master (april 2023)
77 =============
78 >```./PM_EI_DEMO.sh remote-remove  docker  --env-file ../common/test_env-onap-london.sh```
79
80 >```./PM_EI_DEMO.sh remote-remove  kube  --env-file ../common/test_env-onap-london.sh```
81 ## Test case categories
82
83 The test script are number using these basic categories where 0-999 are related to the policy management and 1000-1999 are related to information management. 2000-2999 are for southbound http proxy. There are also demo test cases that test more or less all components. These test scripts does not use the numbering scheme below.
84
85 The numbering in each series corresponds to the following groupings
86 1-99 - Basic sanity tests, A1PMS
87
88 100-199 - API tests, A1PMS
89
90 300-399 - Config changes and sync, A1PMS
91
92 800-899 - Stability and capacity test, A1PMS
93
94 900-999 - Misc test, A1PMS
95
96 11XX - ICS API Tests
97
98 18XX - ICS Stability and capacity test
99
100 20XX - Southbound http proxy tests
101
102 30XX - rApp tests
103
104 40XX - Helm Manager tests
105
106 Suites
107
108 To get an overview of the available test scripts, use the following command to print the test script description:
109 'grep ONELINE *.sh' in the dir of the test scripts.
110
111
112
113 ## Test case file - template
114
115 A test script contains a number of steps to verify a certain functionality.
116 The empty template for a test case file looks like this.
117 Only the parts noted with < and > shall be changed.
118 It is strongly suggested to look at the existing test scripts, it is probably easier to copy an existing test script instead of creating one from scratch. The README.md in  `../common/` describes the functions available in the test script in detail.
119
120 -----------------------------------------------------------
121
122 ```
123 #!/bin/bash
124
125 <license text>
126
127 TC_ONELINE_DESCR="<test case description>"
128
129 DOCKER_INCLUDED_IMAGES=<list of used apps in this test case - for docker>
130
131 KUBE_INCLUDED_IMAGES=<list of used apps (started by the script) in this test case - for kube>
132 KUBE_PRESTARTED_IMAGES=<list of used apps (pre-started - i.e. not started by the script) in this test case - for kube>
133
134 SUPPORTED_PROFILES=<list of supported profile names>
135
136 SUPPORTED_RUNMODES=<List of runmodes, DOCKER and/or KUBE>
137
138 CONDITIONALLY_IGNORED_IMAGES=<list of images to exclude if it does not exist in the profile file>
139
140 . ../common/testcase_common.sh $@
141
142 setup_testenvironment
143
144 #### TEST BEGIN ####
145
146
147 <tests here>
148
149
150 #### TEST COMPLETE ####
151
152 print_result
153
154 store_logs          END
155
156 ```
157
158 -----------------------------------------------------------
159
160 ## License
161
162 Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
163 Licensed under the Apache License, Version 2.0 (the "License");
164 you may not use this file except in compliance with the License.
165 You may obtain a copy of the License at
166
167      http://www.apache.org/licenses/LICENSE-2.0
168
169 Unless required by applicable law or agreed to in writing, software
170 distributed under the License is distributed on an "AS IS" BASIS,
171 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
172 See the License for the specific language governing permissions and
173 limitations under the License.