Merge "Make logging in Mediator Producer managed by REST"
[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 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 The requirements, in terms of the execution enviroment, 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, perferably with the kube dashboard installed.
12 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 only been verified on MacOS.
13
14 ## Configuration
15
16 The test scripts uses configuration from a single file, found in `../common/test_env.sh`, which contains all needed configuration in terms of image names, image tags, ports, file paths, passwords etc. This file can be modified if needed.  See the README.md in  `../common/` for all details of the config file.
17
18 ## How to run
19
20 A test script, for example FTC1, is executed from the cmd line using the script filename and one or more parameters:
21
22  >```./FTC1.sh remote docker --env-file ../common/test_env-oran-cherry.sh```
23
24 Note that not is running on a released verion, the parameter "release" shall be included to run the released images.
25
26 See the README.md in  `../common/` for all details about available parameters and their meaning.
27
28 Each test script prints out the overall result of the tests in the end of the execution.
29
30 The test scripts produce quite a number of logs; all container logs, a log of all http/htps 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/`. So each test script is using its own log directory.
31
32 To test all components on a very basic level, run the demo test script(s) for the desired release.
33 Note that oran tests only include components from oran.
34 Note that onap test uses components from onap combined with released oran components available at that onap release (e.g. Honolulu contains onap images from honolulu and oran images from cherry)
35
36
37 ORAN CHERRY
38 ===========
39 >```./PM_EI_DEMO.sh remote-remove  docker release   --env-file ../common/test_env-oran-cherry.sh```
40
41 >```./PM_EI_DEMO.sh remote-remove  kube  release --env-file ../common/test_env-oran-cherry.sh```
42
43 ORAN D-RELEASE
44 =========
45 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-oran-d-release.sh  --use-release-image SDNC```
46
47 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-oran-d-release.sh  --use-release-image SDNC```
48
49 ORAN E-RELEASE
50 =========
51 >```./PM_EI_DEMO.sh remote-remove  docker  --env-file ../common/test_env-oran-e-release.sh```
52
53 >```./PM_EI_DEMO.sh remote-remove  kube  --env-file ../common/test_env-oran-e-release.sh```
54
55 ONAP GUILIN
56 ===========
57 >```./PM_DEMO.sh remote-remove  docker release   --env-file ../common/test_env-onap-guilin.sh```
58
59 >```./PM_DEMO.sh remote-remove  kube  release --env-file ../common/test_env-onap-guilin.sh```
60
61 Note that ECS was not available before oran cherry so a test script without ECS is used.
62
63 ONAP HONOLULU
64 =============
65 >```./PM_EI_DEMO.sh remote-remove  docker release  --env-file ../common/test_env-onap-honolulu.sh```
66
67 >```./PM_EI_DEMO.sh remote-remove  kube  release --env-file ../common/test_env-onap-honolulu.sh```
68
69 ONAP ISTANBUL
70 =============
71 >```./PM_EI_DEMO.sh remote-remove  docker  release  --env-file ../common/test_env-onap-istanbul.sh```
72
73 >```./PM_EI_DEMO.sh remote-remove  kube  release  --env-file ../common/test_env-onap-istanbul.sh```
74
75 Note: When istanbul is released, add the 'release' arg to run released images.
76
77 ## Test case categories
78
79 The test script are number using these basic categories where 0-999 are releated to the policy managment and 1000-1999 are related to enrichment 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.
80
81 The numbering in each series corresponds to the following groupings
82 1-99 - Basic sanity tests
83
84 100-199 - API tests
85
86 300-399 - Config changes and sync
87
88 800-899 - Stability and capacity test
89
90 900-999 - Misc test
91
92 11XX - ECS API Tests
93
94 18XX - ECS Stability and capacity test
95
96 2000 - Southbound http proxy tests
97
98 30XX - rApp tests
99
100 Suites
101
102 To get an overview of the available test scripts, use the following command to print the test script description:
103 'grep ONELINE *.sh' in the dir of the test scripts.
104
105 ## Test case file - template
106
107 A test script contains a number of steps to verify a certain functionality.
108 The empty template for a test case file looks like this.
109 Only the parts noted with < and > shall be changed.
110 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.
111
112 -----------------------------------------------------------
113
114 ```
115 #!/bin/bash
116
117 TC_ONELINE_DESCR="<test case description>"
118
119 DOCKER_INCLUDED_IMAGES=<list of used apps in this test case - for docker>
120
121 KUBE_INCLUDED_IMAGES=<list of used apps (started by the script) in this test case - for kube>
122 KUBE_PRESTARTED_IMAGES=<list of used apps (prestartedd - i.e. not started by the script) in this test case - for kube>
123
124 SUPPORTED_PROFILES=<list of supported profile names>
125
126 SUPPORTED_RUNMODES=<List of runmodes, DOCKER and/or KUBE>
127
128 CONDITIONALLY_IGNORED_IMAGES=<list of images to exclude if it does not exist in the profile file>
129
130 . ../common/testcase_common.sh $@
131
132 setup_testenvironment
133
134 #### TEST BEGIN ####
135
136
137 <tests here>
138
139
140 #### TEST COMPLETE ####
141
142 store_logs          END
143
144 ```
145
146 -----------------------------------------------------------
147
148 ## License
149
150 Copyright (C) 2020 Nordix Foundation. All rights reserved.
151 Licensed under the Apache License, Version 2.0 (the "License");
152 you may not use this file except in compliance with the License.
153 You may obtain a copy of the License at
154
155      http://www.apache.org/licenses/LICENSE-2.0
156
157 Unless required by applicable law or agreed to in writing, software
158 distributed under the License is distributed on an "AS IS" BASIS,
159 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
160 See the License for the specific language governing permissions and
161 limitations under the License.