@itentialopensource/adapter-azure_aks 0.1.1 → 0.3.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/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +295 -0
- package/CHANGELOG.md +17 -2
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +3 -148
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +235 -576
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +385 -271
- package/adapterBase.js +854 -408
- package/changelogs/changelog.md +16 -0
- package/entities/.generic/action.json +110 -5
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/metadata.json +49 -0
- package/package.json +27 -22
- package/pronghorn.json +691 -88
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +828 -7
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +3708 -0
- package/report/adapter-openapi.yaml +3084 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653089062336.json +120 -0
- package/report/updateReport1691507435017.json +120 -0
- package/report/updateReport1692202466826.json +120 -0
- package/report/updateReport1694460918275.json +120 -0
- package/report/updateReport1698420595972.json +120 -0
- package/sampleProperties.json +153 -3
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +155 -110
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +484 -247
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +1 -1
- package/utils/basicGet.js +1 -14
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +179 -0
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +14 -16
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +5 -0
- package/utils/removeHooks.js +20 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +129 -53
- package/utils/tbUtils.js +125 -25
- package/utils/testRunner.js +17 -17
- package/utils/troubleshootingAdapter.js +10 -31
- package/workflows/README.md +0 -3
|
@@ -4,36 +4,48 @@
|
|
|
4
4
|
/* global describe it log pronghornProps */
|
|
5
5
|
/* eslint global-require: warn */
|
|
6
6
|
/* eslint no-unused-vars: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require:warn */
|
|
7
8
|
|
|
8
9
|
// include required items for testing & logging
|
|
9
10
|
const assert = require('assert');
|
|
10
|
-
const fs = require('fs-extra');
|
|
11
|
-
const mocha = require('mocha');
|
|
12
11
|
const path = require('path');
|
|
13
12
|
const util = require('util');
|
|
14
|
-
const winston = require('winston');
|
|
15
13
|
const execute = require('child_process').execSync;
|
|
14
|
+
const fs = require('fs-extra');
|
|
15
|
+
const mocha = require('mocha');
|
|
16
|
+
const winston = require('winston');
|
|
16
17
|
const { expect } = require('chai');
|
|
17
18
|
const { use } = require('chai');
|
|
18
19
|
const td = require('testdouble');
|
|
20
|
+
const Ajv = require('ajv');
|
|
19
21
|
|
|
22
|
+
const ajv = new Ajv({ strictSchema: false, allErrors: true, allowUnionTypes: true });
|
|
20
23
|
const anything = td.matchers.anything();
|
|
21
|
-
|
|
22
|
-
// stub and attemptTimeout are used throughout the code so set them here
|
|
23
24
|
let logLevel = 'none';
|
|
24
|
-
const stub = true;
|
|
25
25
|
const isRapidFail = false;
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
// read in the properties from the sampleProperties files
|
|
28
|
+
let adaptdir = __dirname;
|
|
29
|
+
if (adaptdir.endsWith('/test/integration')) {
|
|
30
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 17);
|
|
31
|
+
} else if (adaptdir.endsWith('/test/unit')) {
|
|
32
|
+
adaptdir = adaptdir.substring(0, adaptdir.length - 10);
|
|
33
|
+
}
|
|
34
|
+
const samProps = require(`${adaptdir}/sampleProperties.json`).properties;
|
|
27
35
|
|
|
28
36
|
// these variables can be changed to run in integrated mode so easier to set them here
|
|
29
37
|
// always check these in with bogus data!!!
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
samProps.stub = true;
|
|
39
|
+
samProps.host = 'replace.hostorip.here';
|
|
40
|
+
samProps.authentication.username = 'username';
|
|
41
|
+
samProps.authentication.password = 'password';
|
|
42
|
+
samProps.protocol = 'http';
|
|
43
|
+
samProps.port = 80;
|
|
44
|
+
samProps.ssl.enabled = false;
|
|
45
|
+
samProps.ssl.accept_invalid_cert = false;
|
|
46
|
+
samProps.request.attempt_timeout = 1200000;
|
|
47
|
+
const attemptTimeout = samProps.request.attempt_timeout;
|
|
48
|
+
const { stub } = samProps;
|
|
37
49
|
|
|
38
50
|
// these are the adapter properties. You generally should not need to alter
|
|
39
51
|
// any of these after they are initially set up
|
|
@@ -45,106 +57,7 @@ global.pronghornProps = {
|
|
|
45
57
|
adapters: [{
|
|
46
58
|
id: 'Test-azure_aks',
|
|
47
59
|
type: 'AzureAks',
|
|
48
|
-
properties:
|
|
49
|
-
host,
|
|
50
|
-
port,
|
|
51
|
-
base_path: '/',
|
|
52
|
-
version: '',
|
|
53
|
-
cache_location: 'none',
|
|
54
|
-
encode_pathvars: true,
|
|
55
|
-
save_metric: false,
|
|
56
|
-
stub,
|
|
57
|
-
protocol,
|
|
58
|
-
apiVersion: '2019-11-01',
|
|
59
|
-
subscriptionId: 'replace_subscriptionId',
|
|
60
|
-
resourceGroup: [],
|
|
61
|
-
authentication: {
|
|
62
|
-
auth_method: 'request_token',
|
|
63
|
-
username,
|
|
64
|
-
password,
|
|
65
|
-
token: '',
|
|
66
|
-
invalid_token_error: 401,
|
|
67
|
-
token_timeout: 1800000,
|
|
68
|
-
token_cache: 'local',
|
|
69
|
-
auth_field: 'header.headers.Authorization',
|
|
70
|
-
auth_field_format: 'Bearer {token}',
|
|
71
|
-
auth_logging: false,
|
|
72
|
-
tenant_id: 'replace_tenant_id',
|
|
73
|
-
client_id: 'replace_client_id',
|
|
74
|
-
grant_type: 'client_credentials',
|
|
75
|
-
client_secret: 'replace_client_secret'
|
|
76
|
-
},
|
|
77
|
-
healthcheck: {
|
|
78
|
-
type: 'none',
|
|
79
|
-
frequency: 60000,
|
|
80
|
-
query_object: {}
|
|
81
|
-
},
|
|
82
|
-
throttle: {
|
|
83
|
-
throttle_enabled: false,
|
|
84
|
-
number_pronghorns: 1,
|
|
85
|
-
sync_async: 'sync',
|
|
86
|
-
max_in_queue: 1000,
|
|
87
|
-
concurrent_max: 1,
|
|
88
|
-
expire_timeout: 0,
|
|
89
|
-
avg_runtime: 200,
|
|
90
|
-
priorities: [
|
|
91
|
-
{
|
|
92
|
-
value: 0,
|
|
93
|
-
percent: 100
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
request: {
|
|
98
|
-
number_redirects: 0,
|
|
99
|
-
number_retries: 3,
|
|
100
|
-
limit_retry_error: [0],
|
|
101
|
-
failover_codes: [],
|
|
102
|
-
attempt_timeout: attemptTimeout,
|
|
103
|
-
global_request: {
|
|
104
|
-
payload: {},
|
|
105
|
-
uriOptions: {},
|
|
106
|
-
addlHeaders: {},
|
|
107
|
-
authData: {}
|
|
108
|
-
},
|
|
109
|
-
healthcheck_on_timeout: true,
|
|
110
|
-
return_raw: true,
|
|
111
|
-
archiving: false,
|
|
112
|
-
return_request: false
|
|
113
|
-
},
|
|
114
|
-
proxy: {
|
|
115
|
-
enabled: false,
|
|
116
|
-
host: '',
|
|
117
|
-
port: 1,
|
|
118
|
-
protocol: 'http',
|
|
119
|
-
username: '',
|
|
120
|
-
password: ''
|
|
121
|
-
},
|
|
122
|
-
ssl: {
|
|
123
|
-
ecdhCurve: '',
|
|
124
|
-
enabled: sslenable,
|
|
125
|
-
accept_invalid_cert: sslinvalid,
|
|
126
|
-
ca_file: '',
|
|
127
|
-
key_file: '',
|
|
128
|
-
cert_file: '',
|
|
129
|
-
secure_protocol: '',
|
|
130
|
-
ciphers: ''
|
|
131
|
-
},
|
|
132
|
-
mongo: {
|
|
133
|
-
host: '',
|
|
134
|
-
port: 0,
|
|
135
|
-
database: '',
|
|
136
|
-
username: '',
|
|
137
|
-
password: '',
|
|
138
|
-
replSet: '',
|
|
139
|
-
db_ssl: {
|
|
140
|
-
enabled: false,
|
|
141
|
-
accept_invalid_cert: false,
|
|
142
|
-
ca_file: '',
|
|
143
|
-
key_file: '',
|
|
144
|
-
cert_file: ''
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
60
|
+
properties: samProps
|
|
148
61
|
}]
|
|
149
62
|
}
|
|
150
63
|
};
|
|
@@ -275,10 +188,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
275
188
|
});
|
|
276
189
|
|
|
277
190
|
let wffunctions = [];
|
|
278
|
-
describe('#
|
|
191
|
+
describe('#iapGetAdapterWorkflowFunctions', () => {
|
|
279
192
|
it('should retrieve workflow functions', (done) => {
|
|
280
193
|
try {
|
|
281
|
-
wffunctions = a.
|
|
194
|
+
wffunctions = a.iapGetAdapterWorkflowFunctions([]);
|
|
282
195
|
|
|
283
196
|
try {
|
|
284
197
|
assert.notEqual(0, wffunctions.length);
|
|
@@ -309,19 +222,24 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
309
222
|
it('package.json should be validated', (done) => {
|
|
310
223
|
try {
|
|
311
224
|
const packageDotJson = require('../../package.json');
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
225
|
+
// Define the JSON schema for package.json
|
|
226
|
+
const packageJsonSchema = {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
name: { type: 'string' },
|
|
230
|
+
version: { type: 'string' }
|
|
231
|
+
// May need to add more properties as needed
|
|
232
|
+
},
|
|
233
|
+
required: ['name', 'version']
|
|
316
234
|
};
|
|
317
|
-
const
|
|
235
|
+
const validate = ajv.compile(packageJsonSchema);
|
|
236
|
+
const isValid = validate(packageDotJson);
|
|
318
237
|
|
|
319
|
-
if (
|
|
320
|
-
log.error('The package.json contains
|
|
321
|
-
|
|
322
|
-
assert.equal(true, results.valid);
|
|
238
|
+
if (isValid === false) {
|
|
239
|
+
log.error('The package.json contains errors');
|
|
240
|
+
assert.equal(true, isValid);
|
|
323
241
|
} else {
|
|
324
|
-
assert.equal(true,
|
|
242
|
+
assert.equal(true, isValid);
|
|
325
243
|
}
|
|
326
244
|
|
|
327
245
|
done();
|
|
@@ -360,6 +278,7 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
360
278
|
assert.notEqual(undefined, packageDotJson.scripts);
|
|
361
279
|
assert.notEqual(null, packageDotJson.scripts);
|
|
362
280
|
assert.notEqual('', packageDotJson.scripts);
|
|
281
|
+
assert.equal('node utils/setup.js', packageDotJson.scripts.preinstall);
|
|
363
282
|
assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
|
|
364
283
|
assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
|
|
365
284
|
assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
|
|
@@ -367,6 +286,8 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
367
286
|
assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
|
|
368
287
|
assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
|
|
369
288
|
assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
|
|
289
|
+
assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
|
|
290
|
+
assert.equal('npm run deploy', packageDotJson.scripts.build);
|
|
370
291
|
done();
|
|
371
292
|
} catch (error) {
|
|
372
293
|
log.error(`Test Failure: ${error}`);
|
|
@@ -379,6 +300,9 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
379
300
|
assert.notEqual(undefined, packageDotJson.repository);
|
|
380
301
|
assert.notEqual(null, packageDotJson.repository);
|
|
381
302
|
assert.notEqual('', packageDotJson.repository);
|
|
303
|
+
assert.equal('git', packageDotJson.repository.type);
|
|
304
|
+
assert.equal('git@gitlab.com:itentialopensource/adapters/', packageDotJson.repository.url.substring(0, 43));
|
|
305
|
+
assert.equal('https://gitlab.com/itentialopensource/adapters/', packageDotJson.homepage.substring(0, 47));
|
|
382
306
|
done();
|
|
383
307
|
} catch (error) {
|
|
384
308
|
log.error(`Test Failure: ${error}`);
|
|
@@ -391,17 +315,17 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
391
315
|
assert.notEqual(undefined, packageDotJson.dependencies);
|
|
392
316
|
assert.notEqual(null, packageDotJson.dependencies);
|
|
393
317
|
assert.notEqual('', packageDotJson.dependencies);
|
|
394
|
-
assert.equal('^
|
|
395
|
-
assert.equal('^
|
|
396
|
-
assert.equal('^
|
|
397
|
-
assert.equal('^
|
|
398
|
-
assert.equal('^
|
|
318
|
+
assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
|
|
319
|
+
assert.equal('^1.6.3', packageDotJson.dependencies.axios);
|
|
320
|
+
assert.equal('^11.0.0', packageDotJson.dependencies.commander);
|
|
321
|
+
assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
|
|
322
|
+
assert.equal('^10.2.0', packageDotJson.dependencies.mocha);
|
|
399
323
|
assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
|
|
400
|
-
assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
|
|
401
324
|
assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
|
|
325
|
+
assert.equal('^0.4.4', packageDotJson.dependencies.ping);
|
|
402
326
|
assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
|
|
403
|
-
assert.equal('^7.3
|
|
404
|
-
assert.equal('^3.
|
|
327
|
+
assert.equal('^7.5.3', packageDotJson.dependencies.semver);
|
|
328
|
+
assert.equal('^3.9.0', packageDotJson.dependencies.winston);
|
|
405
329
|
done();
|
|
406
330
|
} catch (error) {
|
|
407
331
|
log.error(`Test Failure: ${error}`);
|
|
@@ -414,13 +338,12 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
414
338
|
assert.notEqual(undefined, packageDotJson.devDependencies);
|
|
415
339
|
assert.notEqual(null, packageDotJson.devDependencies);
|
|
416
340
|
assert.notEqual('', packageDotJson.devDependencies);
|
|
417
|
-
assert.equal('^4.3.
|
|
418
|
-
assert.equal('^
|
|
419
|
-
assert.equal('^
|
|
420
|
-
assert.equal('^2.
|
|
421
|
-
assert.equal('^3.
|
|
422
|
-
assert.equal('^
|
|
423
|
-
assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
|
|
341
|
+
assert.equal('^4.3.7', packageDotJson.devDependencies.chai);
|
|
342
|
+
assert.equal('^8.44.0', packageDotJson.devDependencies.eslint);
|
|
343
|
+
assert.equal('^15.0.0', packageDotJson.devDependencies['eslint-config-airbnb-base']);
|
|
344
|
+
assert.equal('^2.27.5', packageDotJson.devDependencies['eslint-plugin-import']);
|
|
345
|
+
assert.equal('^3.1.0', packageDotJson.devDependencies['eslint-plugin-json']);
|
|
346
|
+
assert.equal('^3.18.0', packageDotJson.devDependencies.testdouble);
|
|
424
347
|
done();
|
|
425
348
|
} catch (error) {
|
|
426
349
|
log.error(`Test Failure: ${error}`);
|
|
@@ -463,16 +386,31 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
463
386
|
assert.notEqual('', pronghornDotJson.methods);
|
|
464
387
|
assert.equal(true, Array.isArray(pronghornDotJson.methods));
|
|
465
388
|
assert.notEqual(0, pronghornDotJson.methods.length);
|
|
466
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
467
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
468
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
469
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
470
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
471
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
472
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
473
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
474
|
-
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === '
|
|
389
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUpdateAdapterConfiguration'));
|
|
390
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapSuspendAdapter'));
|
|
391
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapUnsuspendAdapter'));
|
|
392
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterQueue'));
|
|
393
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapFindAdapterPath'));
|
|
394
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapTroubleshootAdapter'));
|
|
395
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterHealthcheck'));
|
|
396
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterConnectivity'));
|
|
397
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterBasicGet'));
|
|
398
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapMoveAdapterEntitiesToDB'));
|
|
399
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapDeactivateTasks'));
|
|
400
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapActivateTasks'));
|
|
401
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapPopulateEntityCache'));
|
|
402
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRetrieveEntitiesCache'));
|
|
403
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevice'));
|
|
404
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getDevicesFiltered'));
|
|
405
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'isAlive'));
|
|
406
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getConfig'));
|
|
407
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetDeviceCount'));
|
|
408
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapExpandedGenericAdapterRequest'));
|
|
475
409
|
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
|
|
410
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequestNoBasePath'));
|
|
411
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterLint'));
|
|
412
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapRunAdapterTests'));
|
|
413
|
+
assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'iapGetAdapterInventory'));
|
|
476
414
|
done();
|
|
477
415
|
} catch (error) {
|
|
478
416
|
log.error(`Test Failure: ${error}`);
|
|
@@ -593,6 +531,39 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
593
531
|
done(error);
|
|
594
532
|
}
|
|
595
533
|
});
|
|
534
|
+
it('pronghorn.json verify input/output schema objects', (done) => {
|
|
535
|
+
const verifySchema = (methodName, schema) => {
|
|
536
|
+
try {
|
|
537
|
+
ajv.compile(schema);
|
|
538
|
+
} catch (error) {
|
|
539
|
+
const errorMessage = `Invalid schema found in '${methodName}' method.
|
|
540
|
+
Schema => ${JSON.stringify(schema)}.
|
|
541
|
+
Details => ${error.message}`;
|
|
542
|
+
throw new Error(errorMessage);
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
try {
|
|
547
|
+
const pronghornDotJson = require('../../pronghorn.json');
|
|
548
|
+
const { methods } = pronghornDotJson;
|
|
549
|
+
for (let i = 0; i < methods.length; i += 1) {
|
|
550
|
+
for (let j = 0; j < methods[i].input.length; j += 1) {
|
|
551
|
+
const inputSchema = methods[i].input[j].schema;
|
|
552
|
+
if (inputSchema) {
|
|
553
|
+
verifySchema(methods[i].name, inputSchema);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const outputSchema = methods[i].output.schema;
|
|
557
|
+
if (outputSchema) {
|
|
558
|
+
verifySchema(methods[i].name, outputSchema);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
done();
|
|
562
|
+
} catch (error) {
|
|
563
|
+
log.error(`Adapter Exception: ${error}`);
|
|
564
|
+
done(error);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
596
567
|
});
|
|
597
568
|
|
|
598
569
|
describe('propertiesSchema.json', () => {
|
|
@@ -628,6 +599,7 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
628
599
|
assert.equal('string', propertiesDotJson.properties.host.type);
|
|
629
600
|
assert.equal('integer', propertiesDotJson.properties.port.type);
|
|
630
601
|
assert.equal('boolean', propertiesDotJson.properties.stub.type);
|
|
602
|
+
assert.equal('string', propertiesDotJson.properties.protocol.type);
|
|
631
603
|
assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
|
|
632
604
|
assert.notEqual(null, propertiesDotJson.definitions.authentication);
|
|
633
605
|
assert.notEqual('', propertiesDotJson.definitions.authentication);
|
|
@@ -644,6 +616,8 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
644
616
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
|
|
645
617
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
|
|
646
618
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
|
|
619
|
+
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
620
|
+
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
647
621
|
assert.notEqual('', propertiesDotJson.definitions.ssl);
|
|
648
622
|
assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
|
|
649
623
|
assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
|
|
@@ -657,8 +631,8 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
657
631
|
assert.equal('string', propertiesDotJson.properties.version.type);
|
|
658
632
|
assert.equal('string', propertiesDotJson.properties.cache_location.type);
|
|
659
633
|
assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
|
|
634
|
+
assert.equal('boolean', propertiesDotJson.properties.encode_queryvars.type);
|
|
660
635
|
assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
|
|
661
|
-
assert.equal('string', propertiesDotJson.properties.protocol.type);
|
|
662
636
|
assert.notEqual(undefined, propertiesDotJson.definitions);
|
|
663
637
|
assert.notEqual(null, propertiesDotJson.definitions);
|
|
664
638
|
assert.notEqual('', propertiesDotJson.definitions);
|
|
@@ -705,8 +679,6 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
705
679
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
|
|
706
680
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
|
|
707
681
|
assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
|
|
708
|
-
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
709
|
-
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
710
682
|
assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
|
|
711
683
|
assert.notEqual(null, propertiesDotJson.definitions.mongo);
|
|
712
684
|
assert.notEqual('', propertiesDotJson.definitions.mongo);
|
|
@@ -722,6 +694,12 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
722
694
|
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
|
|
723
695
|
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
|
|
724
696
|
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
|
|
697
|
+
assert.notEqual('', propertiesDotJson.definitions.devicebroker);
|
|
698
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
|
|
699
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
|
|
700
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
|
|
701
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
|
|
702
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
|
|
725
703
|
done();
|
|
726
704
|
} catch (error) {
|
|
727
705
|
log.error(`Test Failure: ${error}`);
|
|
@@ -811,6 +789,7 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
811
789
|
assert.notEqual(undefined, sampleDotJson.properties.host);
|
|
812
790
|
assert.notEqual(undefined, sampleDotJson.properties.port);
|
|
813
791
|
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
792
|
+
assert.notEqual(undefined, sampleDotJson.properties.protocol);
|
|
814
793
|
assert.notEqual(undefined, sampleDotJson.properties.authentication);
|
|
815
794
|
assert.notEqual(null, sampleDotJson.properties.authentication);
|
|
816
795
|
assert.notEqual('', sampleDotJson.properties.authentication);
|
|
@@ -838,17 +817,12 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
838
817
|
assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
|
|
839
818
|
assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
|
|
840
819
|
assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
|
|
841
|
-
|
|
842
820
|
assert.notEqual(undefined, sampleDotJson.properties.base_path);
|
|
843
821
|
assert.notEqual(undefined, sampleDotJson.properties.version);
|
|
844
822
|
assert.notEqual(undefined, sampleDotJson.properties.cache_location);
|
|
845
823
|
assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
|
|
824
|
+
assert.notEqual(undefined, sampleDotJson.properties.encode_queryvars);
|
|
846
825
|
assert.notEqual(undefined, sampleDotJson.properties.save_metric);
|
|
847
|
-
assert.notEqual(undefined, sampleDotJson.properties.protocol);
|
|
848
|
-
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
849
|
-
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
850
|
-
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
851
|
-
assert.notEqual(undefined, sampleDotJson.properties.stub);
|
|
852
826
|
assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
|
|
853
827
|
assert.notEqual(null, sampleDotJson.properties.healthcheck);
|
|
854
828
|
assert.notEqual('', sampleDotJson.properties.healthcheck);
|
|
@@ -907,6 +881,14 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
907
881
|
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
|
|
908
882
|
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
|
|
909
883
|
assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
|
|
884
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker);
|
|
885
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevice);
|
|
886
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getDevicesFiltered);
|
|
887
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.isAlive);
|
|
888
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getConfig);
|
|
889
|
+
assert.notEqual(undefined, sampleDotJson.properties.devicebroker.getCount);
|
|
890
|
+
assert.notEqual(undefined, sampleDotJson.properties.cache);
|
|
891
|
+
assert.notEqual(undefined, sampleDotJson.properties.cache.entities);
|
|
910
892
|
done();
|
|
911
893
|
} catch (error) {
|
|
912
894
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1000,10 +982,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1000
982
|
});
|
|
1001
983
|
});
|
|
1002
984
|
|
|
1003
|
-
describe('#
|
|
1004
|
-
it('should have a
|
|
985
|
+
describe('#iapUpdateAdapterConfiguration', () => {
|
|
986
|
+
it('should have a iapUpdateAdapterConfiguration function', (done) => {
|
|
1005
987
|
try {
|
|
1006
|
-
assert.equal(true, typeof a.
|
|
988
|
+
assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
|
|
1007
989
|
done();
|
|
1008
990
|
} catch (error) {
|
|
1009
991
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1012,44 +994,34 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1012
994
|
});
|
|
1013
995
|
});
|
|
1014
996
|
|
|
1015
|
-
describe('#
|
|
1016
|
-
it('should have a
|
|
997
|
+
describe('#iapSuspendAdapter', () => {
|
|
998
|
+
it('should have a iapSuspendAdapter function', (done) => {
|
|
1017
999
|
try {
|
|
1018
|
-
assert.equal(true, typeof a.
|
|
1000
|
+
assert.equal(true, typeof a.iapSuspendAdapter === 'function');
|
|
1019
1001
|
done();
|
|
1020
1002
|
} catch (error) {
|
|
1021
1003
|
log.error(`Test Failure: ${error}`);
|
|
1022
1004
|
done(error);
|
|
1023
1005
|
}
|
|
1024
1006
|
});
|
|
1025
|
-
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
describe('#iapUnsuspendAdapter', () => {
|
|
1010
|
+
it('should have a iapUnsuspendAdapter function', (done) => {
|
|
1026
1011
|
try {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
assert.equal(undefined, error);
|
|
1030
|
-
assert.notEqual(undefined, data);
|
|
1031
|
-
assert.notEqual(null, data);
|
|
1032
|
-
assert.equal(true, data.found);
|
|
1033
|
-
assert.notEqual(undefined, data.foundIn);
|
|
1034
|
-
assert.notEqual(null, data.foundIn);
|
|
1035
|
-
assert.notEqual(0, data.foundIn.length);
|
|
1036
|
-
done();
|
|
1037
|
-
} catch (err) {
|
|
1038
|
-
log.error(`Test Failure: ${err}`);
|
|
1039
|
-
done(err);
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1012
|
+
assert.equal(true, typeof a.iapUnsuspendAdapter === 'function');
|
|
1013
|
+
done();
|
|
1042
1014
|
} catch (error) {
|
|
1043
|
-
log.error(`
|
|
1015
|
+
log.error(`Test Failure: ${error}`);
|
|
1044
1016
|
done(error);
|
|
1045
1017
|
}
|
|
1046
|
-
})
|
|
1018
|
+
});
|
|
1047
1019
|
});
|
|
1048
1020
|
|
|
1049
|
-
describe('#
|
|
1050
|
-
it('should have a
|
|
1021
|
+
describe('#iapGetAdapterQueue', () => {
|
|
1022
|
+
it('should have a iapGetAdapterQueue function', (done) => {
|
|
1051
1023
|
try {
|
|
1052
|
-
assert.equal(true, typeof a.
|
|
1024
|
+
assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
|
|
1053
1025
|
done();
|
|
1054
1026
|
} catch (error) {
|
|
1055
1027
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1058,22 +1030,44 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1058
1030
|
});
|
|
1059
1031
|
});
|
|
1060
1032
|
|
|
1061
|
-
describe('#
|
|
1062
|
-
it('should have a
|
|
1033
|
+
describe('#iapFindAdapterPath', () => {
|
|
1034
|
+
it('should have a iapFindAdapterPath function', (done) => {
|
|
1063
1035
|
try {
|
|
1064
|
-
assert.equal(true, typeof a.
|
|
1036
|
+
assert.equal(true, typeof a.iapFindAdapterPath === 'function');
|
|
1065
1037
|
done();
|
|
1066
1038
|
} catch (error) {
|
|
1067
1039
|
log.error(`Test Failure: ${error}`);
|
|
1068
1040
|
done(error);
|
|
1069
1041
|
}
|
|
1070
1042
|
});
|
|
1043
|
+
it('iapFindAdapterPath should find atleast one path that matches', (done) => {
|
|
1044
|
+
try {
|
|
1045
|
+
a.iapFindAdapterPath('{base_path}/{version}', (data, error) => {
|
|
1046
|
+
try {
|
|
1047
|
+
assert.equal(undefined, error);
|
|
1048
|
+
assert.notEqual(undefined, data);
|
|
1049
|
+
assert.notEqual(null, data);
|
|
1050
|
+
assert.equal(true, data.found);
|
|
1051
|
+
assert.notEqual(undefined, data.foundIn);
|
|
1052
|
+
assert.notEqual(null, data.foundIn);
|
|
1053
|
+
assert.notEqual(0, data.foundIn.length);
|
|
1054
|
+
done();
|
|
1055
|
+
} catch (err) {
|
|
1056
|
+
log.error(`Test Failure: ${err}`);
|
|
1057
|
+
done(err);
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
} catch (error) {
|
|
1061
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1062
|
+
done(error);
|
|
1063
|
+
}
|
|
1064
|
+
}).timeout(attemptTimeout);
|
|
1071
1065
|
});
|
|
1072
1066
|
|
|
1073
|
-
describe('#
|
|
1074
|
-
it('should have a
|
|
1067
|
+
describe('#iapTroubleshootAdapter', () => {
|
|
1068
|
+
it('should have a iapTroubleshootAdapter function', (done) => {
|
|
1075
1069
|
try {
|
|
1076
|
-
assert.equal(true, typeof a.
|
|
1070
|
+
assert.equal(true, typeof a.iapTroubleshootAdapter === 'function');
|
|
1077
1071
|
done();
|
|
1078
1072
|
} catch (error) {
|
|
1079
1073
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1082,10 +1076,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1082
1076
|
});
|
|
1083
1077
|
});
|
|
1084
1078
|
|
|
1085
|
-
describe('#
|
|
1086
|
-
it('should have a
|
|
1079
|
+
describe('#iapRunAdapterHealthcheck', () => {
|
|
1080
|
+
it('should have a iapRunAdapterHealthcheck function', (done) => {
|
|
1087
1081
|
try {
|
|
1088
|
-
assert.equal(true, typeof a.
|
|
1082
|
+
assert.equal(true, typeof a.iapRunAdapterHealthcheck === 'function');
|
|
1089
1083
|
done();
|
|
1090
1084
|
} catch (error) {
|
|
1091
1085
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1094,10 +1088,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1094
1088
|
});
|
|
1095
1089
|
});
|
|
1096
1090
|
|
|
1097
|
-
describe('#
|
|
1098
|
-
it('should have a
|
|
1091
|
+
describe('#iapRunAdapterConnectivity', () => {
|
|
1092
|
+
it('should have a iapRunAdapterConnectivity function', (done) => {
|
|
1099
1093
|
try {
|
|
1100
|
-
assert.equal(true, typeof a.
|
|
1094
|
+
assert.equal(true, typeof a.iapRunAdapterConnectivity === 'function');
|
|
1101
1095
|
done();
|
|
1102
1096
|
} catch (error) {
|
|
1103
1097
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1106,10 +1100,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1106
1100
|
});
|
|
1107
1101
|
});
|
|
1108
1102
|
|
|
1109
|
-
describe('#
|
|
1110
|
-
it('should have a
|
|
1103
|
+
describe('#iapRunAdapterBasicGet', () => {
|
|
1104
|
+
it('should have a iapRunAdapterBasicGet function', (done) => {
|
|
1111
1105
|
try {
|
|
1112
|
-
assert.equal(true, typeof a.
|
|
1106
|
+
assert.equal(true, typeof a.iapRunAdapterBasicGet === 'function');
|
|
1113
1107
|
done();
|
|
1114
1108
|
} catch (error) {
|
|
1115
1109
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1118,10 +1112,10 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1118
1112
|
});
|
|
1119
1113
|
});
|
|
1120
1114
|
|
|
1121
|
-
describe('#
|
|
1122
|
-
it('should have a
|
|
1115
|
+
describe('#iapMoveAdapterEntitiesToDB', () => {
|
|
1116
|
+
it('should have a iapMoveAdapterEntitiesToDB function', (done) => {
|
|
1123
1117
|
try {
|
|
1124
|
-
assert.equal(true, typeof a.
|
|
1118
|
+
assert.equal(true, typeof a.iapMoveAdapterEntitiesToDB === 'function');
|
|
1125
1119
|
done();
|
|
1126
1120
|
} catch (error) {
|
|
1127
1121
|
log.error(`Test Failure: ${error}`);
|
|
@@ -1215,50 +1209,293 @@ describe('[unit] Azure_aks Adapter Test', () => {
|
|
|
1215
1209
|
}).timeout(attemptTimeout);
|
|
1216
1210
|
});
|
|
1217
1211
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
// }
|
|
1254
|
-
// });
|
|
1255
|
-
// } catch (error) {
|
|
1256
|
-
// log.error(`Adapter Exception: ${error}`);
|
|
1257
|
-
// done(error);
|
|
1258
|
-
// }
|
|
1259
|
-
// }).timeout(attemptTimeout);
|
|
1260
|
-
// });
|
|
1212
|
+
describe('#iapDeactivateTasks', () => {
|
|
1213
|
+
it('should have a iapDeactivateTasks function', (done) => {
|
|
1214
|
+
try {
|
|
1215
|
+
assert.equal(true, typeof a.iapDeactivateTasks === 'function');
|
|
1216
|
+
done();
|
|
1217
|
+
} catch (error) {
|
|
1218
|
+
log.error(`Test Failure: ${error}`);
|
|
1219
|
+
done(error);
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
describe('#iapActivateTasks', () => {
|
|
1225
|
+
it('should have a iapActivateTasks function', (done) => {
|
|
1226
|
+
try {
|
|
1227
|
+
assert.equal(true, typeof a.iapActivateTasks === 'function');
|
|
1228
|
+
done();
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
log.error(`Test Failure: ${error}`);
|
|
1231
|
+
done(error);
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
describe('#iapPopulateEntityCache', () => {
|
|
1237
|
+
it('should have a iapPopulateEntityCache function', (done) => {
|
|
1238
|
+
try {
|
|
1239
|
+
assert.equal(true, typeof a.iapPopulateEntityCache === 'function');
|
|
1240
|
+
done();
|
|
1241
|
+
} catch (error) {
|
|
1242
|
+
log.error(`Test Failure: ${error}`);
|
|
1243
|
+
done(error);
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
});
|
|
1261
1247
|
|
|
1248
|
+
describe('#iapRetrieveEntitiesCache', () => {
|
|
1249
|
+
it('should have a iapRetrieveEntitiesCache function', (done) => {
|
|
1250
|
+
try {
|
|
1251
|
+
assert.equal(true, typeof a.iapRetrieveEntitiesCache === 'function');
|
|
1252
|
+
done();
|
|
1253
|
+
} catch (error) {
|
|
1254
|
+
log.error(`Test Failure: ${error}`);
|
|
1255
|
+
done(error);
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
describe('#hasEntities', () => {
|
|
1261
|
+
it('should have a hasEntities function', (done) => {
|
|
1262
|
+
try {
|
|
1263
|
+
assert.equal(true, typeof a.hasEntities === 'function');
|
|
1264
|
+
done();
|
|
1265
|
+
} catch (error) {
|
|
1266
|
+
log.error(`Test Failure: ${error}`);
|
|
1267
|
+
done(error);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
});
|
|
1271
|
+
|
|
1272
|
+
describe('#getDevice', () => {
|
|
1273
|
+
it('should have a getDevice function', (done) => {
|
|
1274
|
+
try {
|
|
1275
|
+
assert.equal(true, typeof a.getDevice === 'function');
|
|
1276
|
+
done();
|
|
1277
|
+
} catch (error) {
|
|
1278
|
+
log.error(`Test Failure: ${error}`);
|
|
1279
|
+
done(error);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
describe('#getDevicesFiltered', () => {
|
|
1285
|
+
it('should have a getDevicesFiltered function', (done) => {
|
|
1286
|
+
try {
|
|
1287
|
+
assert.equal(true, typeof a.getDevicesFiltered === 'function');
|
|
1288
|
+
done();
|
|
1289
|
+
} catch (error) {
|
|
1290
|
+
log.error(`Test Failure: ${error}`);
|
|
1291
|
+
done(error);
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
describe('#isAlive', () => {
|
|
1297
|
+
it('should have a isAlive function', (done) => {
|
|
1298
|
+
try {
|
|
1299
|
+
assert.equal(true, typeof a.isAlive === 'function');
|
|
1300
|
+
done();
|
|
1301
|
+
} catch (error) {
|
|
1302
|
+
log.error(`Test Failure: ${error}`);
|
|
1303
|
+
done(error);
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
describe('#getConfig', () => {
|
|
1309
|
+
it('should have a getConfig function', (done) => {
|
|
1310
|
+
try {
|
|
1311
|
+
assert.equal(true, typeof a.getConfig === 'function');
|
|
1312
|
+
done();
|
|
1313
|
+
} catch (error) {
|
|
1314
|
+
log.error(`Test Failure: ${error}`);
|
|
1315
|
+
done(error);
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
describe('#iapGetDeviceCount', () => {
|
|
1321
|
+
it('should have a iapGetDeviceCount function', (done) => {
|
|
1322
|
+
try {
|
|
1323
|
+
assert.equal(true, typeof a.iapGetDeviceCount === 'function');
|
|
1324
|
+
done();
|
|
1325
|
+
} catch (error) {
|
|
1326
|
+
log.error(`Test Failure: ${error}`);
|
|
1327
|
+
done(error);
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
describe('#iapExpandedGenericAdapterRequest', () => {
|
|
1333
|
+
it('should have a iapExpandedGenericAdapterRequest function', (done) => {
|
|
1334
|
+
try {
|
|
1335
|
+
assert.equal(true, typeof a.iapExpandedGenericAdapterRequest === 'function');
|
|
1336
|
+
done();
|
|
1337
|
+
} catch (error) {
|
|
1338
|
+
log.error(`Test Failure: ${error}`);
|
|
1339
|
+
done(error);
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
describe('#genericAdapterRequest', () => {
|
|
1345
|
+
it('should have a genericAdapterRequest function', (done) => {
|
|
1346
|
+
try {
|
|
1347
|
+
assert.equal(true, typeof a.genericAdapterRequest === 'function');
|
|
1348
|
+
done();
|
|
1349
|
+
} catch (error) {
|
|
1350
|
+
log.error(`Test Failure: ${error}`);
|
|
1351
|
+
done(error);
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
describe('#genericAdapterRequestNoBasePath', () => {
|
|
1357
|
+
it('should have a genericAdapterRequestNoBasePath function', (done) => {
|
|
1358
|
+
try {
|
|
1359
|
+
assert.equal(true, typeof a.genericAdapterRequestNoBasePath === 'function');
|
|
1360
|
+
done();
|
|
1361
|
+
} catch (error) {
|
|
1362
|
+
log.error(`Test Failure: ${error}`);
|
|
1363
|
+
done(error);
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
describe('#iapRunAdapterLint', () => {
|
|
1369
|
+
it('should have a iapRunAdapterLint function', (done) => {
|
|
1370
|
+
try {
|
|
1371
|
+
assert.equal(true, typeof a.iapRunAdapterLint === 'function');
|
|
1372
|
+
done();
|
|
1373
|
+
} catch (error) {
|
|
1374
|
+
log.error(`Test Failure: ${error}`);
|
|
1375
|
+
done(error);
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1378
|
+
it('retrieve the lint results', (done) => {
|
|
1379
|
+
try {
|
|
1380
|
+
a.iapRunAdapterLint((data, error) => {
|
|
1381
|
+
try {
|
|
1382
|
+
assert.equal(undefined, error);
|
|
1383
|
+
assert.notEqual(undefined, data);
|
|
1384
|
+
assert.notEqual(null, data);
|
|
1385
|
+
assert.notEqual(undefined, data.status);
|
|
1386
|
+
assert.notEqual(null, data.status);
|
|
1387
|
+
assert.equal('SUCCESS', data.status);
|
|
1388
|
+
done();
|
|
1389
|
+
} catch (err) {
|
|
1390
|
+
log.error(`Test Failure: ${err}`);
|
|
1391
|
+
done(err);
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1396
|
+
done(error);
|
|
1397
|
+
}
|
|
1398
|
+
}).timeout(attemptTimeout);
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
describe('#iapRunAdapterTests', () => {
|
|
1402
|
+
it('should have a iapRunAdapterTests function', (done) => {
|
|
1403
|
+
try {
|
|
1404
|
+
assert.equal(true, typeof a.iapRunAdapterTests === 'function');
|
|
1405
|
+
done();
|
|
1406
|
+
} catch (error) {
|
|
1407
|
+
log.error(`Test Failure: ${error}`);
|
|
1408
|
+
done(error);
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
describe('#iapGetAdapterInventory', () => {
|
|
1414
|
+
it('should have a iapGetAdapterInventory function', (done) => {
|
|
1415
|
+
try {
|
|
1416
|
+
assert.equal(true, typeof a.iapGetAdapterInventory === 'function');
|
|
1417
|
+
done();
|
|
1418
|
+
} catch (error) {
|
|
1419
|
+
log.error(`Test Failure: ${error}`);
|
|
1420
|
+
done(error);
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
it('retrieve the inventory', (done) => {
|
|
1424
|
+
try {
|
|
1425
|
+
a.iapGetAdapterInventory((data, error) => {
|
|
1426
|
+
try {
|
|
1427
|
+
assert.equal(undefined, error);
|
|
1428
|
+
assert.notEqual(undefined, data);
|
|
1429
|
+
assert.notEqual(null, data);
|
|
1430
|
+
done();
|
|
1431
|
+
} catch (err) {
|
|
1432
|
+
log.error(`Test Failure: ${err}`);
|
|
1433
|
+
done(err);
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
} catch (error) {
|
|
1437
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1438
|
+
done(error);
|
|
1439
|
+
}
|
|
1440
|
+
}).timeout(attemptTimeout);
|
|
1441
|
+
});
|
|
1442
|
+
describe('metadata.json', () => {
|
|
1443
|
+
it('should have a metadata.json', (done) => {
|
|
1444
|
+
try {
|
|
1445
|
+
fs.exists('metadata.json', (val) => {
|
|
1446
|
+
assert.equal(true, val);
|
|
1447
|
+
done();
|
|
1448
|
+
});
|
|
1449
|
+
} catch (error) {
|
|
1450
|
+
log.error(`Test Failure: ${error}`);
|
|
1451
|
+
done(error);
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1454
|
+
it('metadata.json is customized', (done) => {
|
|
1455
|
+
try {
|
|
1456
|
+
const metadataDotJson = require('../../metadata.json');
|
|
1457
|
+
assert.equal('adapter-azure_aks', metadataDotJson.name);
|
|
1458
|
+
assert.notEqual(undefined, metadataDotJson.webName);
|
|
1459
|
+
assert.notEqual(null, metadataDotJson.webName);
|
|
1460
|
+
assert.notEqual('', metadataDotJson.webName);
|
|
1461
|
+
assert.equal('Adapter', metadataDotJson.type);
|
|
1462
|
+
done();
|
|
1463
|
+
} catch (error) {
|
|
1464
|
+
log.error(`Test Failure: ${error}`);
|
|
1465
|
+
done(error);
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
it('metadata.json contains accurate documentation', (done) => {
|
|
1469
|
+
try {
|
|
1470
|
+
const metadataDotJson = require('../../metadata.json');
|
|
1471
|
+
assert.notEqual(undefined, metadataDotJson.documentation);
|
|
1472
|
+
assert.equal('https://www.npmjs.com/package/@itentialopensource/adapter-azure_aks', metadataDotJson.documentation.npmLink);
|
|
1473
|
+
assert.equal('https://docs.itential.com/opensource/docs/troubleshooting-an-adapter', metadataDotJson.documentation.faqLink);
|
|
1474
|
+
assert.equal('https://gitlab.com/itentialopensource/adapters/contributing-guide', metadataDotJson.documentation.contributeLink);
|
|
1475
|
+
assert.equal('https://itential.atlassian.net/servicedesk/customer/portals', metadataDotJson.documentation.issueLink);
|
|
1476
|
+
done();
|
|
1477
|
+
} catch (error) {
|
|
1478
|
+
log.error(`Test Failure: ${error}`);
|
|
1479
|
+
done(error);
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
it('metadata.json has related items', (done) => {
|
|
1483
|
+
try {
|
|
1484
|
+
const metadataDotJson = require('../../metadata.json');
|
|
1485
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems);
|
|
1486
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.adapters);
|
|
1487
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.integrations);
|
|
1488
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.ecosystemApplications);
|
|
1489
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.workflowProjects);
|
|
1490
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.transformationProjects);
|
|
1491
|
+
assert.notEqual(undefined, metadataDotJson.relatedItems.exampleProjects);
|
|
1492
|
+
done();
|
|
1493
|
+
} catch (error) {
|
|
1494
|
+
log.error(`Test Failure: ${error}`);
|
|
1495
|
+
done(error);
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
});
|
|
1262
1499
|
/*
|
|
1263
1500
|
-----------------------------------------------------------------------
|
|
1264
1501
|
-----------------------------------------------------------------------
|