@itentialopensource/adapter-vmware_vcenter 0.5.3 → 0.7.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/.eslintignore +1 -0
- package/.eslintrc.js +12 -12
- package/CHANGELOG.md +32 -0
- package/README.md +209 -29
- package/adapter.js +1476 -34
- package/adapterBase.js +289 -11
- package/entities/.generic/action.json +109 -0
- package/entities/.generic/schema.json +23 -0
- package/entities/.system/action.json +3 -3
- package/entities/.system/schemaTokenReq.json +2 -2
- package/entities/Vmtemplatelibraryitems/action.json +25 -0
- package/entities/Vmtemplatelibraryitems/schema.json +19 -0
- package/error.json +6 -0
- package/package.json +42 -21
- package/pronghorn.json +614 -0
- package/propertiesSchema.json +56 -9
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1594310791028.json +95 -0
- package/report/updateReport1615860501665.json +95 -0
- package/report/updateReport1643047821981.json +95 -0
- package/sampleProperties.json +20 -5
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +59 -6
- package/test/unit/adapterBaseTestUnit.js +944 -0
- package/test/unit/adapterTestUnit.js +683 -10
- package/utils/addAuth.js +94 -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 +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +451 -0
- package/utils/troubleshootingAdapter.js +190 -0
|
@@ -13,7 +13,10 @@ const winston = require('winston');
|
|
|
13
13
|
const { expect } = require('chai');
|
|
14
14
|
const { use } = require('chai');
|
|
15
15
|
const td = require('testdouble');
|
|
16
|
+
const util = require('util');
|
|
17
|
+
const pronghorn = require('../../pronghorn.json');
|
|
16
18
|
|
|
19
|
+
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
17
20
|
const anything = td.matchers.anything();
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
@@ -49,6 +52,7 @@ global.pronghornProps = {
|
|
|
49
52
|
base_path: '',
|
|
50
53
|
version: '',
|
|
51
54
|
cache_location: '',
|
|
55
|
+
encode_pathvars: true,
|
|
52
56
|
save_metric: false,
|
|
53
57
|
protocol,
|
|
54
58
|
stub,
|
|
@@ -61,11 +65,16 @@ global.pronghornProps = {
|
|
|
61
65
|
token_cache: 'local',
|
|
62
66
|
invalid_token_error: 401,
|
|
63
67
|
auth_field: 'header.headers.Authorization',
|
|
64
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
|
|
68
|
+
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
69
|
+
auth_logging: false,
|
|
70
|
+
client_id: '',
|
|
71
|
+
client_secret: '',
|
|
72
|
+
grant_type: ''
|
|
65
73
|
},
|
|
66
74
|
healthcheck: {
|
|
67
75
|
type: 'startup',
|
|
68
|
-
frequency: 60000
|
|
76
|
+
frequency: 60000,
|
|
77
|
+
query_object: {}
|
|
69
78
|
},
|
|
70
79
|
throttle: {
|
|
71
80
|
throttle_enabled: false,
|
|
@@ -74,7 +83,13 @@ global.pronghornProps = {
|
|
|
74
83
|
max_in_queue: 1000,
|
|
75
84
|
concurrent_max: 1,
|
|
76
85
|
expire_timeout: 0,
|
|
77
|
-
avg_runtime: 200
|
|
86
|
+
avg_runtime: 200,
|
|
87
|
+
priorities: [
|
|
88
|
+
{
|
|
89
|
+
value: 0,
|
|
90
|
+
percent: 100
|
|
91
|
+
}
|
|
92
|
+
]
|
|
78
93
|
},
|
|
79
94
|
request: {
|
|
80
95
|
number_redirects: 0,
|
|
@@ -90,13 +105,16 @@ global.pronghornProps = {
|
|
|
90
105
|
},
|
|
91
106
|
healthcheck_on_timeout: false,
|
|
92
107
|
return_raw: true,
|
|
93
|
-
archiving: false
|
|
108
|
+
archiving: false,
|
|
109
|
+
return_request: false
|
|
94
110
|
},
|
|
95
111
|
proxy: {
|
|
96
112
|
enabled: false,
|
|
97
113
|
host: '',
|
|
98
114
|
port: 1,
|
|
99
|
-
protocol: 'http'
|
|
115
|
+
protocol: 'http',
|
|
116
|
+
username: '',
|
|
117
|
+
password: ''
|
|
100
118
|
},
|
|
101
119
|
ssl: {
|
|
102
120
|
ecdhCurve: '',
|
|
@@ -298,7 +316,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
298
316
|
}
|
|
299
317
|
|
|
300
318
|
// require the adapter that we are going to be using
|
|
301
|
-
const VmwareVCenter = require('../../adapter
|
|
319
|
+
const VmwareVCenter = require('../../adapter');
|
|
302
320
|
|
|
303
321
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
304
322
|
describe('[integration] Vmware_vCenter Adapter Test', () => {
|
|
@@ -329,6 +347,8 @@ describe('[integration] Vmware_vCenter Adapter Test', () => {
|
|
|
329
347
|
try {
|
|
330
348
|
assert.notEqual(null, a);
|
|
331
349
|
assert.notEqual(undefined, a);
|
|
350
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
351
|
+
assert.equal(checkId, a.id);
|
|
332
352
|
assert.notEqual(null, a.allProps);
|
|
333
353
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
334
354
|
assert.equal(check, a.healthcheckType);
|
|
@@ -3507,5 +3527,38 @@ describe('[integration] Vmware_vCenter Adapter Test', () => {
|
|
|
3507
3527
|
}
|
|
3508
3528
|
}).timeout(attemptTimeout);
|
|
3509
3529
|
});
|
|
3530
|
+
|
|
3531
|
+
describe('#postVcentervmtemplatedeploy - errors', () => {
|
|
3532
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
3533
|
+
try {
|
|
3534
|
+
a.postVcentervmtemplatedeploy('fakedata', { key: 'value' }, (data, error) => {
|
|
3535
|
+
try {
|
|
3536
|
+
if (stub) {
|
|
3537
|
+
assert.notEqual(undefined, error);
|
|
3538
|
+
assert.notEqual(null, error);
|
|
3539
|
+
assert.equal(null, data);
|
|
3540
|
+
assert.equal('AD.500', error.icode);
|
|
3541
|
+
assert.equal('Error 400 received on request', error.IAPerror.displayString);
|
|
3542
|
+
const temp = 'no mock data for';
|
|
3543
|
+
assert.equal(0, error.IAPerror.raw_response.message.indexOf(temp));
|
|
3544
|
+
} else {
|
|
3545
|
+
assert.equal(undefined, error);
|
|
3546
|
+
assert.notEqual(undefined, data);
|
|
3547
|
+
assert.notEqual(null, data);
|
|
3548
|
+
assert.notEqual(null, data.response);
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
done();
|
|
3552
|
+
} catch (err) {
|
|
3553
|
+
log.error(`Test Failure: ${err}`);
|
|
3554
|
+
done(err);
|
|
3555
|
+
}
|
|
3556
|
+
});
|
|
3557
|
+
} catch (error) {
|
|
3558
|
+
log.error(`Adapter Exception: ${error}`);
|
|
3559
|
+
done(error);
|
|
3560
|
+
}
|
|
3561
|
+
}).timeout(attemptTimeout);
|
|
3562
|
+
});
|
|
3510
3563
|
});
|
|
3511
3564
|
});
|