Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# dps-crs-converter integration tests
## Folder structure
testing/
* crs_converter_test_core/
* ...
* crs_converter_test_$PROVIDER_NAME/
* jwt_client.py
* run_test.py
This integration test uses a swagger generated Python client to test a
deployed crs-converter service. The source is located in this repository
```./api_spec/crs_converter_openapi.json```.
The python client code is automatically generated. The latest online version (May 2018)
created incorrect impost statements for cyclic class references. Therefore the current
code is generated using [swagger-codegen-cli-2.2.3.jar](http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar).
The command to create the python code is:
Linux
```bash
cd testing
java -jar ~/swagger-codegen-cli-2.2.3.jar generate -i crs_converter_test_core/api_spec/crs_converter_openapi.json -l python -o crs_converter_test_core/v2
```
Windows
```bat
cd testing
java -jar %UserProfile%\repositories\azure\swagger-codegen-cli-2.2.3.jar generate -i crs_converter_test_core\api_spec\crs_converter_openapi.json -l python -o crs_converter_test_core\v2
```
## Sanity Test: ```test_crs_converter.py```
This test is intended as a simple sanity test. It is quick but doesn't challenge the conversion engine thoroughly
The following parameters are expected as environment variables:
## GCP auth provider (crs_converter_test_gcp/jwt_client.py)
| Variable | Contents |
|----------|----------|
| INTEGRATION_TESTER | go to the google IAM & admin console, navigate to Service accounts to create a key and download the account info file. |
| GOOGLE_AUDIENCES | |
## Tests core (crs_converter_test_core/constants.py)
| Variable | Contents |
|----------|----------|
| BASE_URL | e.g. `/api/crs/converter/v2` |
| VIRTUAL_SERVICE_HOST_NAME | e.g. open.opendes.cloud.slb-ds.com |
| MY_TENANT | e.g. opendes |
| DATA_DIR | e.g. ```E:\tmp\CloudTestData``` |
| DATA_PATTERN | Test*.0*.json |
| REPORT_PATH | e.g. ```E:\tmp\CloudTestData\Report\SuiteReport.txt``` |
## Building/running ```test_crs_converter.py```
Go to the provider folder:
```bash
cd crs_converter_test_$PROVIDER_NAME/
```
To set up a virtual environment:
```bash
virtualenv venv
python3 -m pip install -r requirements.txt
```
To activate on Windows:
```bash
venv\Scripts\activate
```
To run:
```bash
python3 run_test.py
```
### Azure Tests
For the python tests to run in Azure, the CI-CD pipeline copies the SIS_DATA folder to the shared storage for the pods to read. If you are setting up the environment manually and not using Azure CI-CD Pipeline, make sure to copy the folder
Sample code:
```bash
search_dir="apachesis_setup/SIS_DATA"
find "$search_dir/" -type f -print0 | while read -d $'\0' file; do
echo "File: $file"
az storage file upload --account-name $accountName --account-key $accountKey --share-name $SHARE_NAME --source "$file" --path "$file"
done
```
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
**Note:** To simulate a runtime exactly as that of the vsts build agent, you can simply exec into the docker image we use for the build agent, and run the tests from inside it. To know how to do this, please follow [this](https://slb-swt.visualstudio.com/data-at-rest/_git/dps-vsts-build-agent?path=%2FREADME.md&version=GBmaster) documentation.
## Suite Test: ```test_suite.py```
This test requires pre-computed test data with expected values. This test - depending on how many data are sent through - will take a significant amount of time.
### Example format for the test data
```
{
"CreateDate": "2017-08-07T15:02:51.8424946+00:00",
"TestData": [
{
"FromCrsPersistableReference": "%7B%22WKT%22%3A%22PROJCS%5B%5C%22DGN_1995_UTM_Zone_48N%5C%22%2CGEOGCS%5B%5C%22GCS_DGN_1995%5C%22%2CDATUM%5B%5C%22D_Datum_Geodesi_Nasional_1995%5C%22%2CSPHEROID%5B%5C%22WGS_1984%5C%22%2C6378137.0%2C298.257223563%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Transverse_Mercator%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C500000.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C105.0%5D%2CPARAMETER%5B%5C%22Scale_Factor%5C%22%2C0.9996%5D%2CPARAMETER%5B%5C%22Latitude_Of_Origin%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%2CAUTHORITY%5B%5C%22EPSG%5C%22%2C23868%5D%5D%22%2C%22Type%22%3A%22LBCRS%22%2C%22EngineVersion%22%3A%22PE_10_3_1%22%2C%22Name%22%3A%22DGN_1995_UTM_Zone_48N%22%2C%22AuthorityCode%22%3A%7B%22Authority%22%3A%22EPSG%22%2C%22Code%22%3A%2223868%22%7D%7D",
"ToCrsPersistableReference": "%7B%22WKT%22%3A%22GEOGCS%5B%5C%22GCS_DGN_1995%5C%22%2CDATUM%5B%5C%22D_Datum_Geodesi_Nasional_1995%5C%22%2CSPHEROID%5B%5C%22WGS_1984%5C%22%2C6378137.0%2C298.257223563%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%2CAUTHORITY%5B%5C%22EPSG%5C%22%2C4755%5D%5D%22%2C%22Type%22%3A%22LBCRS%22%2C%22EngineVersion%22%3A%22PE_10_3_1%22%2C%22Name%22%3A%22GCS_DGN_1995%22%2C%22AuthorityCode%22%3A%7B%22Authority%22%3A%22EPSG%22%2C%22Code%22%3A%224755%22%7D%7D",
"FromInfo": "DGN_1995_UTM_Zone_48N [m]",
"ToInfo": "GCS_DGN_1995 [dega]",
"Info": "Late-bound CRS Conversions",
"FromToPoints": [
{
"FromPoint": {
"X": 166021.4430837048,
"Y": 0.0,
"Z": 0.0
},
"ToPoint": {
"X": 102.0,
"Y": 0.0,
"Z": 0.0
}
},
{
"FromPoint": {
"X": 833978.5569162938,
"Y": 0.0,
"Z": 0.0
},
"ToPoint": {
"X": 108.0,
"Y": 0.0,
"Z": 0.0
}
},
{
"FromPoint": {
"X": 168456.68464518717,
"Y": 768165.58302924014,
"Z": 0.0
},
"ToPoint": {
"X": 102.0,
"Y": 6.94,
"Z": 0.0
}
},
{
"FromPoint": {
"X": 831543.31535481149,
"Y": 768165.58302924014,
"Z": 0.0
},
"ToPoint": {
"X": 108.0,
"Y": 6.94,
"Z": 0.0
}
},
{
"FromPoint": {
"X": 500000.0,
"Y": 383543.96537060448,
"Z": 0.0
},
"ToPoint": {
"X": 105.0,
"Y": 3.47,
"Z": 0.0
}
}
]
}
]
}
```
## Building/running ```test_suite.py```
To set up a virtual environment:
```bash
virtualenv venv
python3 -m pip install -r requirements.txt
```
To activate on Windows:
```bash
venv\Scripts\activate
```
To run:
```bash
python test_suite.py
```