@itentialopensource/adapter-att_mobility 0.5.7 → 0.6.0
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/.eslintrc.js +1 -0
- package/AUTH.md +4 -4
- package/BROKER.md +4 -4
- package/CALLS.md +8 -8
- package/ENHANCE.md +3 -3
- package/PROPERTIES.md +24 -9
- package/README.md +24 -23
- package/SUMMARY.md +2 -2
- package/SYSTEMINFO.md +1 -1
- package/TAB1.md +2 -2
- package/TAB2.md +8 -4
- package/TROUBLESHOOT.md +10 -1
- package/UTILITIES.md +473 -0
- package/adapter.js +12 -12
- package/adapterBase.js +52 -16
- package/package.json +24 -27
- package/pronghorn.json +15 -13
- package/propertiesSchema.json +68 -7
- package/report/adapterInfo.json +7 -7
- package/report/auto-adapter-openapi.json +248 -0
- package/report/updateReport1748551931265.json +120 -0
- package/sampleProperties.json +4 -0
- package/test/integration/adapterTestBasicGet.js +88 -54
- package/test/integration/adapterTestConnectivity.js +15 -16
- package/test/integration/adapterTestIntegration.js +12 -45
- package/test/unit/adapterBaseTestUnit.js +641 -39
- package/test/unit/adapterTestUnit.js +28 -61
- package/utils/adapterInfo.js +114 -164
- package/utils/argParser.js +44 -0
- package/utils/checkMigrate.js +77 -38
- package/utils/entitiesToDB.js +53 -42
- package/utils/logger.js +26 -0
- package/utils/modify.js +56 -55
- package/utils/mongoDbConnection.js +79 -0
- package/utils/mongoUtils.js +162 -0
- package/utils/taskMover.js +31 -32
- package/utils/tbScript.js +36 -172
- package/utils/tbUtils.js +84 -226
- package/utils/troubleshootingAdapter.js +68 -84
- package/utils/updateAdapterConfig.js +158 -0
- package/utils/addAuth.js +0 -94
- package/utils/artifactize.js +0 -146
- package/utils/basicGet.js +0 -50
- package/utils/packModificationScript.js +0 -35
- package/utils/patches2bundledDeps.js +0 -90
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"paths": {
|
|
8
|
+
"/sp/mobilityactivations/api/v1/serviceactivation/{requestId}": {
|
|
9
|
+
"get": {
|
|
10
|
+
"tags": [
|
|
11
|
+
"Sp"
|
|
12
|
+
],
|
|
13
|
+
"operationId": "getServiceActivationStatus",
|
|
14
|
+
"description": "The parameters and request body are for method: getServiceActivationStatus. Same endpoint also used in methods:",
|
|
15
|
+
"responses": {
|
|
16
|
+
"200": {
|
|
17
|
+
"description": "Successful operation",
|
|
18
|
+
"content": {
|
|
19
|
+
"application/json": {
|
|
20
|
+
"schema": {
|
|
21
|
+
"title": "result",
|
|
22
|
+
"type": "object"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"parameters": [
|
|
29
|
+
{
|
|
30
|
+
"name": "requestId",
|
|
31
|
+
"in": "path",
|
|
32
|
+
"required": true,
|
|
33
|
+
"schema": {
|
|
34
|
+
"title": "requestId",
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"requestBody": {
|
|
40
|
+
"content": {
|
|
41
|
+
"application/json": {
|
|
42
|
+
"schema": {
|
|
43
|
+
"type": "object"
|
|
44
|
+
},
|
|
45
|
+
"example": {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"/sp/mobility/billingmgmt/api/v1/billingaccount/{billingAccountNumber}": {
|
|
52
|
+
"get": {
|
|
53
|
+
"tags": [
|
|
54
|
+
"Sp"
|
|
55
|
+
],
|
|
56
|
+
"operationId": "getBillingAccountDetails",
|
|
57
|
+
"description": "The parameters and request body are for method: getBillingAccountDetails. Same endpoint also used in methods:",
|
|
58
|
+
"responses": {
|
|
59
|
+
"200": {
|
|
60
|
+
"description": "Successful operation",
|
|
61
|
+
"content": {
|
|
62
|
+
"application/json": {
|
|
63
|
+
"schema": {
|
|
64
|
+
"title": "result",
|
|
65
|
+
"type": "object"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"parameters": [
|
|
72
|
+
{
|
|
73
|
+
"name": "billingAccountNumber",
|
|
74
|
+
"in": "path",
|
|
75
|
+
"required": true,
|
|
76
|
+
"schema": {
|
|
77
|
+
"title": "billingAccountNumber",
|
|
78
|
+
"type": "string"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"requestBody": {
|
|
83
|
+
"content": {
|
|
84
|
+
"application/json": {
|
|
85
|
+
"schema": {
|
|
86
|
+
"type": "object"
|
|
87
|
+
},
|
|
88
|
+
"example": {}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"/sp/mobility/lineconfig/api/v1/service/{subscriberLine}": {
|
|
95
|
+
"get": {
|
|
96
|
+
"tags": [
|
|
97
|
+
"Sp"
|
|
98
|
+
],
|
|
99
|
+
"operationId": "getSubscriberLineDetails",
|
|
100
|
+
"description": "The parameters and request body are for method: getSubscriberLineDetails. Same endpoint also used in methods:",
|
|
101
|
+
"responses": {
|
|
102
|
+
"200": {
|
|
103
|
+
"description": "Successful operation",
|
|
104
|
+
"content": {
|
|
105
|
+
"application/json": {
|
|
106
|
+
"schema": {
|
|
107
|
+
"title": "result",
|
|
108
|
+
"type": "object"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"parameters": [
|
|
115
|
+
{
|
|
116
|
+
"name": "subscriberLine",
|
|
117
|
+
"in": "path",
|
|
118
|
+
"required": true,
|
|
119
|
+
"schema": {
|
|
120
|
+
"title": "subscriberLine",
|
|
121
|
+
"type": "string"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"requestBody": {
|
|
126
|
+
"content": {
|
|
127
|
+
"application/json": {
|
|
128
|
+
"schema": {
|
|
129
|
+
"type": "object"
|
|
130
|
+
},
|
|
131
|
+
"example": {}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"/sp/mobilityactivations/api/v1/serviceactivation": {
|
|
138
|
+
"post": {
|
|
139
|
+
"tags": [
|
|
140
|
+
"Sp"
|
|
141
|
+
],
|
|
142
|
+
"operationId": "postServiceActivation",
|
|
143
|
+
"description": "The parameters and request body are for method: postServiceActivation. Same endpoint also used in methods:",
|
|
144
|
+
"responses": {
|
|
145
|
+
"200": {
|
|
146
|
+
"description": "Successful operation",
|
|
147
|
+
"content": {
|
|
148
|
+
"application/json": {
|
|
149
|
+
"schema": {
|
|
150
|
+
"title": "result",
|
|
151
|
+
"type": "object"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"requestBody": {
|
|
158
|
+
"description": "indeterminate body object",
|
|
159
|
+
"content": {
|
|
160
|
+
"application/json": {
|
|
161
|
+
"schema": {
|
|
162
|
+
"type": "object"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"/sp/mobility/lineconfig/api/v1/service/{subsciberLine}": {
|
|
170
|
+
"patch": {
|
|
171
|
+
"tags": [
|
|
172
|
+
"Sp"
|
|
173
|
+
],
|
|
174
|
+
"operationId": "editSubscriberLineDetails",
|
|
175
|
+
"description": "The parameters and request body are for method: editSubscriberLineDetails. Same endpoint also used in methods:",
|
|
176
|
+
"responses": {
|
|
177
|
+
"200": {
|
|
178
|
+
"description": "Successful operation",
|
|
179
|
+
"content": {
|
|
180
|
+
"application/json": {
|
|
181
|
+
"schema": {
|
|
182
|
+
"title": "result",
|
|
183
|
+
"type": "object"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"parameters": [
|
|
190
|
+
{
|
|
191
|
+
"name": "subsciberLine",
|
|
192
|
+
"in": "path",
|
|
193
|
+
"required": true,
|
|
194
|
+
"schema": {
|
|
195
|
+
"title": "subsciberLine",
|
|
196
|
+
"type": "string"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"requestBody": {
|
|
201
|
+
"description": "indeterminate body object",
|
|
202
|
+
"content": {
|
|
203
|
+
"application/json": {
|
|
204
|
+
"schema": {
|
|
205
|
+
"type": "object"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"/api/mobility/lineDetails/imei": {
|
|
213
|
+
"post": {
|
|
214
|
+
"tags": [
|
|
215
|
+
"Mobility"
|
|
216
|
+
],
|
|
217
|
+
"operationId": "queryDeviceByIMEI",
|
|
218
|
+
"description": "The parameters and request body are for method: queryDeviceByIMEI. Same endpoint also used in methods:",
|
|
219
|
+
"responses": {
|
|
220
|
+
"200": {
|
|
221
|
+
"description": "Successful operation",
|
|
222
|
+
"content": {
|
|
223
|
+
"application/json": {
|
|
224
|
+
"schema": {
|
|
225
|
+
"title": "result",
|
|
226
|
+
"type": "object"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"requestBody": {
|
|
233
|
+
"content": {
|
|
234
|
+
"application/json": {
|
|
235
|
+
"schema": {
|
|
236
|
+
"type": "object"
|
|
237
|
+
},
|
|
238
|
+
"example": {}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"components": {
|
|
246
|
+
"schemas": {}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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": 31
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 15
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 6
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 19
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "5.10.16"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 79
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "markdown",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 345
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
52
|
+
"value": 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
57
|
+
"value": 662
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
62
|
+
"value": 57
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
67
|
+
"value": 70
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the BROKER.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "unitTestJS",
|
|
76
|
+
"description": "Number of lines of code in unit tests",
|
|
77
|
+
"value": 1648
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "unitTestJS",
|
|
81
|
+
"description": "Number of unit tests",
|
|
82
|
+
"value": 80
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "integrationTestJS",
|
|
86
|
+
"description": "Number of lines of code in integration tests",
|
|
87
|
+
"value": 601
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "integrationTestJS",
|
|
91
|
+
"description": "Number of integration tests",
|
|
92
|
+
"value": 15
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "staticFile",
|
|
96
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
97
|
+
"value": 1489
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "staticFile",
|
|
101
|
+
"description": "Number of static files added",
|
|
102
|
+
"value": 37
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "Overall",
|
|
106
|
+
"description": "Total lines of Code",
|
|
107
|
+
"value": 3738
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "Overall",
|
|
111
|
+
"description": "Total Tests",
|
|
112
|
+
"value": 95
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "Overall",
|
|
116
|
+
"description": "Total Files",
|
|
117
|
+
"value": 6
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -95,18 +95,22 @@
|
|
|
95
95
|
"enabled": false,
|
|
96
96
|
"accept_invalid_cert": false,
|
|
97
97
|
"ca_file": "",
|
|
98
|
+
"ca_file_content": "",
|
|
98
99
|
"key_file": "",
|
|
99
100
|
"cert_file": "",
|
|
100
101
|
"secure_protocol": "",
|
|
101
102
|
"ciphers": ""
|
|
102
103
|
},
|
|
103
104
|
"mongo": {
|
|
105
|
+
"url": "",
|
|
104
106
|
"host": "",
|
|
105
107
|
"port": 0,
|
|
106
108
|
"database": "",
|
|
109
|
+
"dbAuth": false,
|
|
107
110
|
"username": "",
|
|
108
111
|
"password": "",
|
|
109
112
|
"replSet": "",
|
|
113
|
+
"addSrv": false,
|
|
110
114
|
"db_ssl": {
|
|
111
115
|
"enabled": false,
|
|
112
116
|
"accept_invalid_cert": false,
|
|
@@ -1,83 +1,117 @@
|
|
|
1
1
|
/* @copyright Itential, LLC 2020 */
|
|
2
2
|
|
|
3
|
-
/* global describe
|
|
3
|
+
/* global describe it log before after */
|
|
4
4
|
/* eslint global-require: warn */
|
|
5
5
|
/* eslint no-unused-vars: warn */
|
|
6
6
|
/* eslint import/no-extraneous-dependencies: warn */
|
|
7
7
|
/* eslint import/no-dynamic-require: warn */
|
|
8
8
|
/* eslint import/no-unresolved: warn */
|
|
9
|
+
/* eslint no-loop-func: warn */
|
|
10
|
+
|
|
11
|
+
/* This performs a number of GET calls (defaults to 5 calls) which do not reuire an input, to test connectivity and functionality.
|
|
12
|
+
The number of calls can be modified if running from CLI. */
|
|
9
13
|
|
|
10
|
-
const path = require('path');
|
|
11
14
|
const assert = require('assert');
|
|
12
|
-
const mocha = require('mocha');
|
|
13
|
-
const itParam = require('mocha-param');
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const { name } = require('../../package.json');
|
|
16
|
+
const log = require('../../utils/logger');
|
|
17
|
+
const { id } = require('../../package.json');
|
|
18
18
|
const { methods } = require('../../pronghorn.json');
|
|
19
|
+
const { parseArgs } = require('../../utils/argParser');
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
properties, maxCalls
|
|
23
|
+
} = parseArgs();
|
|
24
|
+
|
|
25
|
+
// require the adapter that we are going to be using
|
|
26
|
+
const TestAdapter = require('../../adapter');
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const pronghornProps = utils.decryptProperties(rawProps, iapDir);
|
|
25
|
-
console.log('Found properties.\n');
|
|
26
|
-
return pronghornProps;
|
|
27
|
-
};
|
|
28
|
+
if (!properties) {
|
|
29
|
+
log.warn('No properties provided. Exiting process.');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
let
|
|
33
|
+
let successCount = 0;
|
|
34
|
+
let calls = 0;
|
|
35
|
+
let attemptTimeout = 60000;
|
|
36
|
+
if (properties.request && properties.request.attempt_timeout) {
|
|
37
|
+
attemptTimeout = properties.request.attempt_timeout;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// turn off stub mode - basic get should not be run in stub mode
|
|
41
|
+
properties.stub = false;
|
|
30
42
|
|
|
31
43
|
describe('[integration] Adapter BasicGET Test', () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
describe('Class Tests', () => {
|
|
45
|
+
const testAdapter = new TestAdapter(
|
|
46
|
+
id,
|
|
47
|
+
properties
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
after((done) => {
|
|
51
|
+
if (successCount === calls) {
|
|
52
|
+
log.info('\x1b[32m%s\x1b[0m', `\n\nSUCCESS: ${successCount} test(s) passed of ${calls} executed!`);
|
|
53
|
+
} else if (successCount > 0) {
|
|
54
|
+
log.error('\x1b[32m%s\x1b[0m', `\n\nPARTIAL SUCCESS: ${successCount} test(s) passed of ${calls} executed!`);
|
|
39
55
|
} else {
|
|
40
|
-
|
|
41
|
-
console.log('Connecting to Database...');
|
|
42
|
-
const database = await basicGet.connect(pronghornProps);
|
|
43
|
-
console.log('Connection established.');
|
|
44
|
-
const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
|
|
45
|
-
{ model: name }
|
|
46
|
-
);
|
|
47
|
-
a = basicGet.getAdapterInstance(adapter);
|
|
56
|
+
log.error('\x1b[31m%s\x1b[0m', '\n\nFAILURE: All tests failed.');
|
|
48
57
|
}
|
|
58
|
+
done();
|
|
49
59
|
});
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
const basicGets = methods.filter((method) => {
|
|
62
|
+
// ignore iapMetadata as the input since its optional and all functions will have it
|
|
63
|
+
const inputKeys = (method.input || [])
|
|
64
|
+
.map((param) => param.name)
|
|
65
|
+
.filter((name) => name !== 'iapMetadata');
|
|
66
|
+
return method.route.verb === 'GET' && inputKeys.length === 0 && !method.name.startsWith('iap');
|
|
53
67
|
});
|
|
54
68
|
|
|
55
|
-
const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
|
|
56
69
|
if (basicGets.length === 0) {
|
|
57
|
-
|
|
58
|
-
process.
|
|
70
|
+
log.warn('No non-parameter GET calls found.');
|
|
71
|
+
process.exitCode = 0;
|
|
72
|
+
return;
|
|
59
73
|
}
|
|
74
|
+
|
|
60
75
|
const functionNames = basicGets.map((g) => g.name);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
calls = functionNames.length;
|
|
77
|
+
if (calls > maxCalls) {
|
|
78
|
+
calls = maxCalls;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// test up to the first 5 get calls without parameters
|
|
82
|
+
for (let f = 0; f < calls; f += 1) {
|
|
83
|
+
const fnName = functionNames[f];
|
|
84
|
+
const method = basicGets.find((m) => m.name === fnName);
|
|
85
|
+
const hasIapMetadata = Array.isArray(method.input) && method.input.some((param) => param.name === 'iapMetadata');
|
|
86
|
+
describe(`#${functionNames[f]}`, () => {
|
|
87
|
+
it('should return valid response without error', (done) => {
|
|
88
|
+
const callback = (data, error) => {
|
|
89
|
+
try {
|
|
90
|
+
assert.equal(undefined, error);
|
|
91
|
+
assert.notEqual(undefined, data);
|
|
92
|
+
assert.notEqual(null, data);
|
|
93
|
+
assert.notEqual(undefined, data.response);
|
|
94
|
+
assert.notEqual(null, data.response);
|
|
95
|
+
successCount += 1;
|
|
96
|
+
done();
|
|
97
|
+
} catch (err) {
|
|
98
|
+
log.error(`Test Failure in ${fnName}: ${err}`);
|
|
99
|
+
done(err);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
if (hasIapMetadata) {
|
|
105
|
+
testAdapter[fnName](null, callback);
|
|
106
|
+
} else {
|
|
107
|
+
testAdapter[fnName](callback);
|
|
67
108
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
reject(new Error(`${f} failed`));
|
|
109
|
+
} catch (err) {
|
|
110
|
+
log.error(`Unexpected error in test for ${fnName}: ${err}`);
|
|
111
|
+
done(err);
|
|
72
112
|
}
|
|
73
|
-
};
|
|
74
|
-
ad[f](getRespCode, console.log);
|
|
113
|
+
}).timeout(attemptTimeout);
|
|
75
114
|
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
itParam('GET call should return 200', functionNames, (fname) => {
|
|
79
|
-
console.log(`\t ${fname}`);
|
|
80
|
-
return request(fname, a).then((result) => assert.equal(result, 200));
|
|
81
|
-
});
|
|
115
|
+
}
|
|
82
116
|
});
|
|
83
117
|
});
|
|
@@ -7,14 +7,11 @@ const assert = require('assert');
|
|
|
7
7
|
const https = require('https');
|
|
8
8
|
const mocha = require('mocha');
|
|
9
9
|
const ping = require('ping');
|
|
10
|
-
const
|
|
10
|
+
const dns = require('dns');
|
|
11
|
+
const { parseArgs } = require('../../utils/argParser');
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (val.indexOf('--HOST') === 0) {
|
|
15
|
-
[, host] = val.split('=');
|
|
16
|
-
}
|
|
17
|
-
});
|
|
13
|
+
const dnsPromises = dns.promises;
|
|
14
|
+
const { host } = parseArgs();
|
|
18
15
|
|
|
19
16
|
describe('[integration] Adapter Test', () => {
|
|
20
17
|
context(`Testing network connection on ${host}`, () => {
|
|
@@ -23,10 +20,10 @@ describe('[integration] Adapter Test', () => {
|
|
|
23
20
|
});
|
|
24
21
|
|
|
25
22
|
it('DNS resolve', (done) => {
|
|
26
|
-
|
|
27
|
-
.then((
|
|
23
|
+
dnsPromises.lookup(host, { all: true })
|
|
24
|
+
.then((result) => {
|
|
28
25
|
try {
|
|
29
|
-
assert.ok(
|
|
26
|
+
assert.ok(result.length > 0);
|
|
30
27
|
done();
|
|
31
28
|
} catch (error) {
|
|
32
29
|
done(error);
|
|
@@ -78,12 +75,13 @@ describe('[integration] Adapter Test', () => {
|
|
|
78
75
|
it('Support IPv4', (done) => {
|
|
79
76
|
const options = {
|
|
80
77
|
family: 4,
|
|
81
|
-
hints:
|
|
78
|
+
hints: dns.ADDRCONFIG
|
|
82
79
|
};
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
.then((
|
|
81
|
+
dnsPromises.lookup(host, options)
|
|
82
|
+
.then((result) => {
|
|
86
83
|
try {
|
|
84
|
+
const { address, family } = result;
|
|
87
85
|
assert.ok(address !== null && family === 4);
|
|
88
86
|
done();
|
|
89
87
|
} catch (error) {
|
|
@@ -98,12 +96,13 @@ describe('[integration] Adapter Test', () => {
|
|
|
98
96
|
it('Support IPv6', (done) => {
|
|
99
97
|
const options = {
|
|
100
98
|
family: 6,
|
|
101
|
-
hints:
|
|
99
|
+
hints: dns.ADDRCONFIG
|
|
102
100
|
};
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
.then((
|
|
102
|
+
dnsPromises.lookup(host, options)
|
|
103
|
+
.then((result) => {
|
|
106
104
|
try {
|
|
105
|
+
const { address, family } = result;
|
|
107
106
|
assert.ok(address !== null && family === 6);
|
|
108
107
|
done();
|
|
109
108
|
} catch (error) {
|