@itentialopensource/adapter-azure_devops 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +5 -0
- package/.eslintrc.js +18 -0
- package/.jshintrc +3 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +48 -0
- package/CONTRIBUTING.md +158 -0
- package/LICENSE +201 -0
- package/README.md +687 -0
- package/adapter.js +1606 -0
- package/adapterBase.js +1028 -0
- package/entities/.generic/action.json +109 -0
- package/entities/.generic/schema.json +23 -0
- package/entities/.system/action.json +50 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +53 -0
- package/entities/.system/schemaTokenResp.json +53 -0
- package/entities/Artifacts/action.json +25 -0
- package/entities/Artifacts/mockdatafiles/artifactsGet-default.json +5 -0
- package/entities/Artifacts/schema.json +41 -0
- package/entities/Logs/action.json +46 -0
- package/entities/Logs/mockdatafiles/logsGet-default.json +11 -0
- package/entities/Logs/mockdatafiles/logsList-default.json +119 -0
- package/entities/Logs/schema.json +42 -0
- package/entities/Pipelines/action.json +66 -0
- package/entities/Pipelines/mockdatafiles/pipelinesCreate-default.json +6 -0
- package/entities/Pipelines/mockdatafiles/pipelinesGet-default.json +6 -0
- package/entities/Pipelines/mockdatafiles/pipelinesList-default.json +26 -0
- package/entities/Pipelines/schema.json +43 -0
- package/entities/Preview/action.json +24 -0
- package/entities/Preview/mockdatafiles/previewPreview-default.json +3 -0
- package/entities/Preview/schema.json +30 -0
- package/entities/Runs/action.json +66 -0
- package/entities/Runs/mockdatafiles/runsGet-default.json +4 -0
- package/entities/Runs/mockdatafiles/runsList-default.json +18 -0
- package/entities/Runs/mockdatafiles/runsRunPipeline-default.json +4 -0
- package/entities/Runs/schema.json +32 -0
- package/error.json +184 -0
- package/package.json +85 -0
- package/pronghorn.json +2488 -0
- package/propertiesSchema.json +840 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/ado.json +1382 -0
- package/report/creationReport.json +228 -0
- package/report/updateReport1639421539710.json +95 -0
- package/sampleProperties.json +106 -0
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +751 -0
- package/test/unit/adapterBaseTestUnit.js +944 -0
- package/test/unit/adapterTestUnit.js +2192 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +224 -0
- package/utils/findPath.js +74 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/pre-commit.sh +27 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +445 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +190 -0
- package/workflows/README.md +3 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "Standard adapter errors available for use",
|
|
7
|
+
"value": 30
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "packageJson",
|
|
11
|
+
"description": "Number of production dependencies",
|
|
12
|
+
"value": 12
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "packageJson",
|
|
16
|
+
"description": "Number of development dependencies",
|
|
17
|
+
"value": 7
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of npm scripts",
|
|
22
|
+
"value": 21
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Runtime Library dependency",
|
|
27
|
+
"value": "^4.44.2"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "propertiesSchemaJson",
|
|
31
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
32
|
+
"value": 64
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "adapterJS",
|
|
36
|
+
"description": "Lines of code generated in adapter.js",
|
|
37
|
+
"value": 1607
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "adapterJS",
|
|
41
|
+
"description": "Number of Functions added to adapter.js",
|
|
42
|
+
"value": 10
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "pronghornJson",
|
|
46
|
+
"description": "Number of Methods added to pronghorn.json",
|
|
47
|
+
"value": 10
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "readmeMd",
|
|
51
|
+
"description": "Number of lines in the README.md",
|
|
52
|
+
"value": 688
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "unitTestJS",
|
|
56
|
+
"description": "Number of lines of code in unit tests",
|
|
57
|
+
"value": 2187
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "unitTestJS",
|
|
61
|
+
"description": "Number of unit tests",
|
|
62
|
+
"value": 104
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "integrationTestJS",
|
|
66
|
+
"description": "Number of lines of code in integration tests",
|
|
67
|
+
"value": 752
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "integrationTestJS",
|
|
71
|
+
"description": "Number of integration tests",
|
|
72
|
+
"value": 15
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "actionJson",
|
|
76
|
+
"description": "Number of actions for Pipelines entity",
|
|
77
|
+
"value": 3
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "actionJson",
|
|
81
|
+
"description": "Number of actions for Preview entity",
|
|
82
|
+
"value": 1
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "actionJson",
|
|
86
|
+
"description": "Number of actions for Runs entity",
|
|
87
|
+
"value": 3
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "actionJson",
|
|
91
|
+
"description": "Number of actions for Artifacts entity",
|
|
92
|
+
"value": 1
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "actionJson",
|
|
96
|
+
"description": "Number of actions for Logs entity",
|
|
97
|
+
"value": 2
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "actionJson",
|
|
101
|
+
"description": "Total number of actions",
|
|
102
|
+
"value": 10
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "actionJson",
|
|
106
|
+
"description": "Total number of entities",
|
|
107
|
+
"value": 5
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "schemaJson",
|
|
111
|
+
"description": "Number of schemas for Pipelines entity",
|
|
112
|
+
"value": 1
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "schemaJson",
|
|
116
|
+
"description": "Number of schemas for Preview entity",
|
|
117
|
+
"value": 1
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"owner": "schemaJson",
|
|
121
|
+
"description": "Number of schemas for Runs entity",
|
|
122
|
+
"value": 1
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"owner": "schemaJson",
|
|
126
|
+
"description": "Number of schemas for Artifacts entity",
|
|
127
|
+
"value": 1
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"owner": "schemaJson",
|
|
131
|
+
"description": "Number of schemas for Logs entity",
|
|
132
|
+
"value": 1
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"owner": "schemaJson",
|
|
136
|
+
"description": "Total number of schemas",
|
|
137
|
+
"value": 5
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"owner": "mockdata",
|
|
141
|
+
"description": "Number of mock data files for Pipelines entity",
|
|
142
|
+
"value": 3
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"owner": "mockdata",
|
|
146
|
+
"description": "Number of mock data files for Preview entity",
|
|
147
|
+
"value": 1
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"owner": "mockdata",
|
|
151
|
+
"description": "Number of mock data files for Runs entity",
|
|
152
|
+
"value": 3
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"owner": "mockdata",
|
|
156
|
+
"description": "Number of mock data files for Artifacts entity",
|
|
157
|
+
"value": 1
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"owner": "mockdata",
|
|
161
|
+
"description": "Number of mock data files for Logs entity",
|
|
162
|
+
"value": 2
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"owner": "mockdata",
|
|
166
|
+
"description": "Total number of mock data files",
|
|
167
|
+
"value": 10
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"owner": "actionJson",
|
|
171
|
+
"description": "Number of actions for .system entity",
|
|
172
|
+
"value": 2
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"owner": "schemaJson",
|
|
176
|
+
"description": "Number of schemas for .system entity",
|
|
177
|
+
"value": 3
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"owner": "mockdata",
|
|
181
|
+
"description": "Number of mock data files for .system entity",
|
|
182
|
+
"value": 2
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"owner": "System",
|
|
186
|
+
"description": "System entity files",
|
|
187
|
+
"value": 6
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"owner": "usecases",
|
|
191
|
+
"description": "Number of workflows",
|
|
192
|
+
"value": 0
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"owner": "staticFile",
|
|
196
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
197
|
+
"value": 1007
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"owner": "staticFile",
|
|
201
|
+
"description": "Number of static files added",
|
|
202
|
+
"value": 31
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"owner": "Overall",
|
|
206
|
+
"description": "Total lines of Code",
|
|
207
|
+
"value": 5553
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"owner": "Overall",
|
|
211
|
+
"description": "Total Tests",
|
|
212
|
+
"value": 119
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"owner": "Overall",
|
|
216
|
+
"description": "Total Files",
|
|
217
|
+
"value": 65
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"apiParsingReport": {
|
|
221
|
+
"no_mockdata": [],
|
|
222
|
+
"errors": [],
|
|
223
|
+
"warnings": [],
|
|
224
|
+
"callsTotal": 10,
|
|
225
|
+
"callsConverted": 10,
|
|
226
|
+
"no_mockdata_num": 0
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 30
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 13
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 7
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 22
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^4.44.11"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 64
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "readmeMd",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 688
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "unitTestJS",
|
|
51
|
+
"description": "Number of lines of code in unit tests",
|
|
52
|
+
"value": 2193
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "unitTestJS",
|
|
56
|
+
"description": "Number of unit tests",
|
|
57
|
+
"value": 104
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "integrationTestJS",
|
|
61
|
+
"description": "Number of lines of code in integration tests",
|
|
62
|
+
"value": 752
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "integrationTestJS",
|
|
66
|
+
"description": "Number of integration tests",
|
|
67
|
+
"value": 15
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "staticFile",
|
|
71
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
72
|
+
"value": 1029
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "staticFile",
|
|
76
|
+
"description": "Number of static files added",
|
|
77
|
+
"value": 33
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "Overall",
|
|
81
|
+
"description": "Total lines of Code",
|
|
82
|
+
"value": 3974
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "Overall",
|
|
86
|
+
"description": "Total Tests",
|
|
87
|
+
"value": 119
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "Overall",
|
|
91
|
+
"description": "Total Files",
|
|
92
|
+
"value": 6
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "Adapter-azure_devops",
|
|
3
|
+
"type": "AzureDevops",
|
|
4
|
+
"properties": {
|
|
5
|
+
"host": "dev.azure.com",
|
|
6
|
+
"port": 443,
|
|
7
|
+
"base_path": "/",
|
|
8
|
+
"version": "",
|
|
9
|
+
"cache_location": "none",
|
|
10
|
+
"encode_pathvars": true,
|
|
11
|
+
"save_metric": true,
|
|
12
|
+
"stub": true,
|
|
13
|
+
"protocol": "https",
|
|
14
|
+
"authentication": {
|
|
15
|
+
"auth_method": "static_token",
|
|
16
|
+
"username": "username",
|
|
17
|
+
"password": "password",
|
|
18
|
+
"token": "token",
|
|
19
|
+
"token_timeout": 600000,
|
|
20
|
+
"token_cache": "local",
|
|
21
|
+
"invalid_token_error": 401,
|
|
22
|
+
"auth_field": "header.headers.Authorization",
|
|
23
|
+
"auth_field_format": "Basic {b64}Basic:{token}{/b64}",
|
|
24
|
+
"auth_logging": false,
|
|
25
|
+
"client_id": "",
|
|
26
|
+
"client_secret": "",
|
|
27
|
+
"grant_type": ""
|
|
28
|
+
},
|
|
29
|
+
"healthcheck": {
|
|
30
|
+
"type": "none",
|
|
31
|
+
"frequency": 60000,
|
|
32
|
+
"query_object": {}
|
|
33
|
+
},
|
|
34
|
+
"throttle": {
|
|
35
|
+
"throttle_enabled": false,
|
|
36
|
+
"number_pronghorns": 1,
|
|
37
|
+
"sync_async": "sync",
|
|
38
|
+
"max_in_queue": 1000,
|
|
39
|
+
"concurrent_max": 1,
|
|
40
|
+
"expire_timeout": 0,
|
|
41
|
+
"avg_runtime": 200,
|
|
42
|
+
"priorities": [
|
|
43
|
+
{
|
|
44
|
+
"value": 0,
|
|
45
|
+
"percent": 100
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"request": {
|
|
50
|
+
"number_redirects": 0,
|
|
51
|
+
"number_retries": 3,
|
|
52
|
+
"limit_retry_error": [
|
|
53
|
+
0
|
|
54
|
+
],
|
|
55
|
+
"failover_codes": [],
|
|
56
|
+
"attempt_timeout": 5000,
|
|
57
|
+
"global_request": {
|
|
58
|
+
"payload": {},
|
|
59
|
+
"uriOptions": {},
|
|
60
|
+
"addlHeaders": {},
|
|
61
|
+
"authData": {}
|
|
62
|
+
},
|
|
63
|
+
"healthcheck_on_timeout": true,
|
|
64
|
+
"return_raw": false,
|
|
65
|
+
"archiving": false,
|
|
66
|
+
"return_request": false
|
|
67
|
+
},
|
|
68
|
+
"proxy": {
|
|
69
|
+
"enabled": false,
|
|
70
|
+
"host": "",
|
|
71
|
+
"port": 1,
|
|
72
|
+
"protocol": "http",
|
|
73
|
+
"username": "",
|
|
74
|
+
"password": ""
|
|
75
|
+
},
|
|
76
|
+
"ssl": {
|
|
77
|
+
"ecdhCurve": "",
|
|
78
|
+
"enabled": false,
|
|
79
|
+
"accept_invalid_cert": false,
|
|
80
|
+
"ca_file": "",
|
|
81
|
+
"key_file": "",
|
|
82
|
+
"cert_file": "",
|
|
83
|
+
"secure_protocol": "",
|
|
84
|
+
"ciphers": ""
|
|
85
|
+
},
|
|
86
|
+
"mongo": {
|
|
87
|
+
"host": "",
|
|
88
|
+
"port": 0,
|
|
89
|
+
"database": "",
|
|
90
|
+
"username": "",
|
|
91
|
+
"password": "",
|
|
92
|
+
"replSet": "",
|
|
93
|
+
"db_ssl": {
|
|
94
|
+
"enabled": false,
|
|
95
|
+
"accept_invalid_cert": false,
|
|
96
|
+
"ca_file": "",
|
|
97
|
+
"key_file": "",
|
|
98
|
+
"cert_file": ""
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"groups": [],
|
|
103
|
+
"brokers": [],
|
|
104
|
+
"logLevel": "none",
|
|
105
|
+
"timeout": 120000
|
|
106
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe context before after */
|
|
4
|
+
/* eslint global-require: warn */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint import/no-extraneous-dependencies: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require: warn */
|
|
8
|
+
/* eslint import/no-unresolved: warn */
|
|
9
|
+
|
|
10
|
+
const mocha = require('mocha');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const assert = require('assert');
|
|
13
|
+
const itParam = require('mocha-param');
|
|
14
|
+
|
|
15
|
+
const utils = require('../../utils/tbUtils');
|
|
16
|
+
const basicGet = require('../../utils/basicGet');
|
|
17
|
+
const { name } = require('../../package.json');
|
|
18
|
+
const { methods } = require('../../pronghorn.json');
|
|
19
|
+
|
|
20
|
+
const getPronghornProps = (iapDir) => {
|
|
21
|
+
const { Discovery } = require('@itential/itential-utils');
|
|
22
|
+
console.log('Retrieving properties.json file...');
|
|
23
|
+
const rawProps = require(path.join(iapDir, 'properties.json'));
|
|
24
|
+
console.log('Decrypting properties...');
|
|
25
|
+
const discovery = new Discovery();
|
|
26
|
+
const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
|
|
27
|
+
console.log('Found properties.\n');
|
|
28
|
+
return pronghornProps;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let a;
|
|
32
|
+
|
|
33
|
+
describe('[integration] Adapter BasicGET Test', () => {
|
|
34
|
+
context('Testing GET calls without query parameters', () => {
|
|
35
|
+
before(async () => {
|
|
36
|
+
const iapDir = path.join(__dirname, '../../../../../');
|
|
37
|
+
if (!utils.withinIAP(iapDir)) {
|
|
38
|
+
const sampleProperties = require('../../sampleProperties.json');
|
|
39
|
+
const adapter = { properties: sampleProperties };
|
|
40
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
41
|
+
} else {
|
|
42
|
+
const pronghornProps = getPronghornProps(iapDir);
|
|
43
|
+
console.log('Connecting to Database...');
|
|
44
|
+
const database = await basicGet.connect(pronghornProps);
|
|
45
|
+
console.log('Connection established.');
|
|
46
|
+
const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
|
|
47
|
+
{ model: name }
|
|
48
|
+
);
|
|
49
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
after((done) => {
|
|
54
|
+
done();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
|
|
58
|
+
if (basicGets.length === 0) {
|
|
59
|
+
console.log('No non-parameter GET calls found.');
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
const functionNames = basicGets.map((g) => g.name);
|
|
63
|
+
const request = function request(f, ad) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const getRespCode = (resp) => {
|
|
66
|
+
if (resp) {
|
|
67
|
+
if (resp.metrics.code !== 200) {
|
|
68
|
+
console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
|
|
69
|
+
}
|
|
70
|
+
resolve(resp.metrics.code);
|
|
71
|
+
} else {
|
|
72
|
+
console.log('\x1b[31m', `call ${f} results in failure`);
|
|
73
|
+
reject(new Error(`${f} failed`));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
ad[f](getRespCode, console.log);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
itParam('GET call should return 200', functionNames, (fname) => {
|
|
81
|
+
console.log(`\t ${fname}`);
|
|
82
|
+
return request(fname, a).then((result) => assert.equal(result, 200));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe it context before after */
|
|
4
|
+
/* eslint no-unused-vars: warn */
|
|
5
|
+
|
|
6
|
+
const mocha = require('mocha');
|
|
7
|
+
const assert = require('assert');
|
|
8
|
+
const diagnostics = require('network-diagnostics');
|
|
9
|
+
|
|
10
|
+
let host;
|
|
11
|
+
process.argv.forEach((val) => {
|
|
12
|
+
if (val.indexOf('--HOST') === 0) {
|
|
13
|
+
[, host] = val.split('=');
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('[integration] Adapter Test', () => {
|
|
18
|
+
context(`Testing network connection on ${host}`, () => {
|
|
19
|
+
before(() => {
|
|
20
|
+
diagnostics.setTestURL(host);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
after((done) => {
|
|
24
|
+
done();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('DNS resolve', (done) => {
|
|
28
|
+
diagnostics.haveDNS((result) => {
|
|
29
|
+
try {
|
|
30
|
+
assert.equal(result, true);
|
|
31
|
+
done();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
done(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('Responds to ping', (done) => {
|
|
39
|
+
diagnostics.havePing((result) => {
|
|
40
|
+
try {
|
|
41
|
+
assert.equal(result, true);
|
|
42
|
+
done();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
done(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('Support HTTP on port 80', (done) => {
|
|
50
|
+
diagnostics.haveHTTP((result) => {
|
|
51
|
+
try {
|
|
52
|
+
assert.equal(result, true);
|
|
53
|
+
done();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
done(error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('Support HTTPS on port 443', (done) => {
|
|
61
|
+
diagnostics.haveHTTPS((result) => {
|
|
62
|
+
try {
|
|
63
|
+
assert.equal(result, true);
|
|
64
|
+
done();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
done(error);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Support IPv4', (done) => {
|
|
72
|
+
diagnostics.haveIPv4Async((result) => {
|
|
73
|
+
try {
|
|
74
|
+
assert.equal(result, true);
|
|
75
|
+
done();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
done(error);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('Support IPv6', (done) => {
|
|
83
|
+
diagnostics.haveIPv6Async((result) => {
|
|
84
|
+
try {
|
|
85
|
+
assert.equal(result, true);
|
|
86
|
+
done();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
done(error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|