@itentialopensource/adapter-gcp_compute 0.2.0 → 1.1.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +85 -12
  3. package/adapter.js +11822 -9796
  4. package/adapterBase.js +40 -3
  5. package/entities/.generic/action.json +5 -5
  6. package/entities/.system/action.json +1 -1
  7. package/entities/AcceleratorTypes/action.json +3 -3
  8. package/entities/Addresses/action.json +5 -5
  9. package/entities/Autoscalers/action.json +7 -7
  10. package/entities/BackendBuckets/action.json +8 -8
  11. package/entities/BackendServices/action.json +11 -11
  12. package/entities/DiskTypes/action.json +3 -3
  13. package/entities/Disks/action.json +13 -13
  14. package/entities/ExternalVpnGateways/action.json +6 -6
  15. package/entities/FirewallPolicies/action.json +382 -0
  16. package/entities/FirewallPolicies/mockdatafiles/addFirewallPolicyAssociation-default.json +45 -0
  17. package/entities/FirewallPolicies/mockdatafiles/addFirewallPolicyRule-default.json +45 -0
  18. package/entities/FirewallPolicies/mockdatafiles/cloneFirewallPolicyRule-default.json +45 -0
  19. package/entities/FirewallPolicies/mockdatafiles/deleteFirewallPolicy-default.json +45 -0
  20. package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicy-default.json +45 -0
  21. package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyAssociation-default.json +7 -0
  22. package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyIamPolicy-default.json +26 -0
  23. package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyRule-default.json +32 -0
  24. package/entities/FirewallPolicies/mockdatafiles/insertFirewallPolicy-default.json +45 -0
  25. package/entities/FirewallPolicies/mockdatafiles/listFirewallPolicy-default.json +75 -0
  26. package/entities/FirewallPolicies/mockdatafiles/listFirewallPolicyAssociations-default.json +12 -0
  27. package/entities/FirewallPolicies/mockdatafiles/moveFirewallPolicy-default.json +45 -0
  28. package/entities/FirewallPolicies/mockdatafiles/patchFirewallPolicy-default.json +57 -0
  29. package/entities/FirewallPolicies/mockdatafiles/patchFirewallPolicyRule-default.json +45 -0
  30. package/entities/FirewallPolicies/mockdatafiles/removeFirewallPolicyAssociation-default.json +45 -0
  31. package/entities/FirewallPolicies/mockdatafiles/removeFirewallPolicyRule-default.json +45 -0
  32. package/entities/FirewallPolicies/mockdatafiles/setFirewallPolicyIamPolicy-default.json +26 -0
  33. package/entities/FirewallPolicies/mockdatafiles/testFirewallPolicyIamPermissions-default.json +6 -0
  34. package/entities/FirewallPolicies/schema.json +47 -0
  35. package/entities/Firewalls/action.json +6 -6
  36. package/entities/ForwardingRules/action.json +7 -7
  37. package/entities/GlobalAddresses/action.json +4 -4
  38. package/entities/GlobalForwardingRules/action.json +6 -6
  39. package/entities/GlobalNetworkEndpointGroups/action.json +7 -7
  40. package/entities/GlobalOperations/action.json +5 -5
  41. package/entities/HealthChecks/action.json +7 -7
  42. package/entities/HttpHealthChecks/action.json +6 -6
  43. package/entities/HttpsHealthChecks/action.json +6 -6
  44. package/entities/Images/action.json +10 -10
  45. package/entities/InstanceGroupManagers/action.json +20 -20
  46. package/entities/InstanceGroups/action.json +9 -9
  47. package/entities/InstanceTemplates/action.json +7 -7
  48. package/entities/Instances/action.json +40 -40
  49. package/entities/InterconnectAttachments/action.json +6 -6
  50. package/entities/InterconnectLocations/action.json +2 -2
  51. package/entities/Interconnects/action.json +6 -6
  52. package/entities/LicenseCodes/action.json +2 -2
  53. package/entities/Licenses/action.json +7 -7
  54. package/entities/MachineTypes/action.json +3 -3
  55. package/entities/NetworkEndpointGroups/action.json +9 -9
  56. package/entities/Networks/action.json +10 -10
  57. package/entities/NodeGroups/action.json +13 -13
  58. package/entities/NodeTemplates/action.json +8 -8
  59. package/entities/NodeTypes/action.json +3 -3
  60. package/entities/PacketMirrorings/action.json +7 -7
  61. package/entities/Projects/action.json +13 -13
  62. package/entities/RegionAutoscalers/action.json +6 -6
  63. package/entities/RegionBackendServices/action.json +7 -7
  64. package/entities/RegionCommitments/action.json +4 -4
  65. package/entities/RegionDiskTypes/action.json +2 -2
  66. package/entities/RegionDisks/action.json +12 -12
  67. package/entities/RegionHealthCheckServices/action.json +5 -5
  68. package/entities/RegionHealthChecks/action.json +6 -6
  69. package/entities/RegionInstanceGroupManagers/action.json +19 -19
  70. package/entities/RegionInstanceGroups/action.json +4 -4
  71. package/entities/RegionNetworkEndpointGroups/action.json +4 -4
  72. package/entities/RegionNotificationEndpoints/action.json +4 -4
  73. package/entities/RegionOperations/action.json +4 -4
  74. package/entities/RegionSslCertificates/action.json +4 -4
  75. package/entities/RegionTargetHttpProxies/action.json +5 -5
  76. package/entities/RegionTargetHttpsProxies/action.json +6 -6
  77. package/entities/RegionUrlMaps/action.json +7 -7
  78. package/entities/Regions/action.json +2 -2
  79. package/entities/Reservations/action.json +9 -9
  80. package/entities/ResourcePolicies/action.json +8 -8
  81. package/entities/Routers/action.json +10 -10
  82. package/entities/Routes/action.json +4 -4
  83. package/entities/SecurityPolicies/action.json +10 -10
  84. package/entities/Snapshots/action.json +7 -7
  85. package/entities/SslCertificates/action.json +5 -5
  86. package/entities/SslPolicies/action.json +6 -6
  87. package/entities/Subnetworks/action.json +12 -12
  88. package/entities/TargetGrpcProxies/action.json +5 -5
  89. package/entities/TargetHttpProxies/action.json +6 -6
  90. package/entities/TargetHttpsProxies/action.json +9 -9
  91. package/entities/TargetInstances/action.json +5 -5
  92. package/entities/TargetPools/action.json +11 -11
  93. package/entities/TargetSslProxies/action.json +8 -8
  94. package/entities/TargetTcpProxies/action.json +6 -6
  95. package/entities/TargetVpnGateways/action.json +5 -5
  96. package/entities/UrlMaps/action.json +9 -9
  97. package/entities/VpnGateways/action.json +8 -8
  98. package/entities/VpnTunnels/action.json +5 -5
  99. package/entities/ZoneOperations/action.json +4 -4
  100. package/entities/Zones/action.json +2 -2
  101. package/error.json +6 -0
  102. package/package.json +19 -18
  103. package/pronghorn.json +11625 -10511
  104. package/propertiesSchema.json +65 -0
  105. package/refs?service=git-upload-pack +0 -0
  106. package/report/updateReport1615068706854.json +95 -0
  107. package/report/updateReport1642776932883.json +95 -0
  108. package/sampleProperties.json +7 -3
  109. package/test/integration/adapterTestBasicGet.js +1 -1
  110. package/test/integration/adapterTestIntegration.js +463 -4
  111. package/test/unit/adapterBaseTestUnit.js +14 -6
  112. package/test/unit/adapterTestUnit.js +1122 -6
  113. package/utils/addAuth.js +94 -0
  114. package/utils/basicGet.js +1 -14
  115. package/utils/entitiesToDB.js +224 -0
  116. package/utils/modify.js +4 -4
  117. package/utils/packModificationScript.js +1 -1
  118. package/utils/patches2bundledDeps.js +90 -0
  119. package/utils/removeHooks.js +20 -0
  120. package/utils/tbScript.js +14 -8
  121. package/utils/tbUtils.js +98 -19
  122. package/utils/troubleshootingAdapter.js +2 -26
  123. package/test/integration/adapterTestIntegration_me.js +0 -464
@@ -23,7 +23,7 @@ const anything = td.matchers.anything();
23
23
  let logLevel = 'none';
24
24
  const stub = true;
25
25
  const isRapidFail = false;
26
- const attemptTimeout = 120000;
26
+ const attemptTimeout = 600000;
27
27
 
28
28
  // these variables can be changed to run in integrated mode so easier to set them here
29
29
  // always check these in with bogus data!!!
@@ -48,8 +48,8 @@ global.pronghornProps = {
48
48
  properties: {
49
49
  host,
50
50
  port,
51
- base_path: '/compute/v1/projects',
52
- version: '',
51
+ base_path: '/compute',
52
+ version: 'v1',
53
53
  cache_location: 'none',
54
54
  encode_pathvars: true,
55
55
  save_metric: false,
@@ -66,6 +66,9 @@ global.pronghornProps = {
66
66
  auth_field: 'header.headers.Authorization',
67
67
  auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
68
68
  auth_logging: false,
69
+ client_id: '',
70
+ client_secret: '',
71
+ grant_type: '',
69
72
  configureGtoken: {
70
73
  email: '',
71
74
  scope: 'https://www.googleapis.com/auth/cloud-platform',
@@ -78,7 +81,8 @@ global.pronghornProps = {
78
81
  },
79
82
  healthcheck: {
80
83
  type: 'none',
81
- frequency: 60000
84
+ frequency: 60000,
85
+ query_object: {}
82
86
  },
83
87
  throttle: {
84
88
  throttle_enabled: false,
@@ -206,7 +210,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
206
210
  }
207
211
 
208
212
  // require the adapter that we are going to be using
209
- const GcpCompute = require('../../adapter.js');
213
+ const GcpCompute = require('../../adapter');
210
214
 
211
215
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
212
216
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -248,6 +252,8 @@ describe('[unit] GcpCompute Adapter Test', () => {
248
252
  try {
249
253
  assert.notEqual(null, a);
250
254
  assert.notEqual(undefined, a);
255
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
256
+ assert.equal(checkId, a.id);
251
257
  assert.notEqual(null, a.allProps);
252
258
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
253
259
  assert.equal(check, a.healthcheckType);
@@ -329,13 +335,103 @@ describe('[unit] GcpCompute Adapter Test', () => {
329
335
  done(error);
330
336
  }
331
337
  });
332
- it('package.json should be customized', (done) => {
338
+ it('package.json standard fields should be customized', (done) => {
333
339
  try {
334
340
  const packageDotJson = require('../../package.json');
335
341
  assert.notEqual(-1, packageDotJson.name.indexOf('gcp_compute'));
336
342
  assert.notEqual(undefined, packageDotJson.version);
337
343
  assert.notEqual(null, packageDotJson.version);
338
344
  assert.notEqual('', packageDotJson.version);
345
+ assert.notEqual(undefined, packageDotJson.description);
346
+ assert.notEqual(null, packageDotJson.description);
347
+ assert.notEqual('', packageDotJson.description);
348
+ assert.equal('adapter.js', packageDotJson.main);
349
+ assert.notEqual(undefined, packageDotJson.wizardVersion);
350
+ assert.notEqual(null, packageDotJson.wizardVersion);
351
+ assert.notEqual('', packageDotJson.wizardVersion);
352
+ assert.notEqual(undefined, packageDotJson.engineVersion);
353
+ assert.notEqual(null, packageDotJson.engineVersion);
354
+ assert.notEqual('', packageDotJson.engineVersion);
355
+ assert.equal('http', packageDotJson.adapterType);
356
+ done();
357
+ } catch (error) {
358
+ log.error(`Test Failure: ${error}`);
359
+ done(error);
360
+ }
361
+ });
362
+ it('package.json proper scripts should be provided', (done) => {
363
+ try {
364
+ const packageDotJson = require('../../package.json');
365
+ assert.notEqual(undefined, packageDotJson.scripts);
366
+ assert.notEqual(null, packageDotJson.scripts);
367
+ assert.notEqual('', packageDotJson.scripts);
368
+ assert.equal('node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions', packageDotJson.scripts.preinstall);
369
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js', packageDotJson.scripts.lint);
370
+ assert.equal('node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet', packageDotJson.scripts['lint:errors']);
371
+ assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
372
+ assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
373
+ assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
374
+ assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
375
+ assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
376
+ assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
377
+ assert.equal('npm run deploy', packageDotJson.scripts.build);
378
+ done();
379
+ } catch (error) {
380
+ log.error(`Test Failure: ${error}`);
381
+ done(error);
382
+ }
383
+ });
384
+ it('package.json proper directories should be provided', (done) => {
385
+ try {
386
+ const packageDotJson = require('../../package.json');
387
+ assert.notEqual(undefined, packageDotJson.repository);
388
+ assert.notEqual(null, packageDotJson.repository);
389
+ assert.notEqual('', packageDotJson.repository);
390
+ assert.equal('git', packageDotJson.repository.type);
391
+ assert.equal('git@gitlab.com:itentialopensource/adapters/', packageDotJson.repository.url.substring(0, 43));
392
+ assert.equal('https://gitlab.com/itentialopensource/adapters/', packageDotJson.homepage.substring(0, 47));
393
+ done();
394
+ } catch (error) {
395
+ log.error(`Test Failure: ${error}`);
396
+ done(error);
397
+ }
398
+ });
399
+ it('package.json proper dependencies should be provided', (done) => {
400
+ try {
401
+ const packageDotJson = require('../../package.json');
402
+ assert.notEqual(undefined, packageDotJson.dependencies);
403
+ assert.notEqual(null, packageDotJson.dependencies);
404
+ assert.notEqual('', packageDotJson.dependencies);
405
+ assert.equal('^6.12.0', packageDotJson.dependencies.ajv);
406
+ assert.equal('^0.21.0', packageDotJson.dependencies.axios);
407
+ assert.equal('^2.20.0', packageDotJson.dependencies.commander);
408
+ assert.equal('^8.1.0', packageDotJson.dependencies['fs-extra']);
409
+ assert.equal('^9.0.1', packageDotJson.dependencies.mocha);
410
+ assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
411
+ assert.equal('^0.5.3', packageDotJson.dependencies['network-diagnostics']);
412
+ assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
413
+ assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
414
+ assert.equal('^7.3.2', packageDotJson.dependencies.semver);
415
+ assert.equal('^3.3.3', packageDotJson.dependencies.winston);
416
+ done();
417
+ } catch (error) {
418
+ log.error(`Test Failure: ${error}`);
419
+ done(error);
420
+ }
421
+ });
422
+ it('package.json proper dev dependencies should be provided', (done) => {
423
+ try {
424
+ const packageDotJson = require('../../package.json');
425
+ assert.notEqual(undefined, packageDotJson.devDependencies);
426
+ assert.notEqual(null, packageDotJson.devDependencies);
427
+ assert.notEqual('', packageDotJson.devDependencies);
428
+ assert.equal('^4.3.4', packageDotJson.devDependencies.chai);
429
+ assert.equal('^7.29.0', packageDotJson.devDependencies.eslint);
430
+ assert.equal('^14.2.1', packageDotJson.devDependencies['eslint-config-airbnb-base']);
431
+ assert.equal('^2.23.4', packageDotJson.devDependencies['eslint-plugin-import']);
432
+ assert.equal('^3.0.0', packageDotJson.devDependencies['eslint-plugin-json']);
433
+ assert.equal('^0.6.3', packageDotJson.devDependencies['package-json-validator']);
434
+ assert.equal('^3.16.1', packageDotJson.devDependencies.testdouble);
339
435
  done();
340
436
  } catch (error) {
341
437
  log.error(`Test Failure: ${error}`);
@@ -360,8 +456,34 @@ describe('[unit] GcpCompute Adapter Test', () => {
360
456
  try {
361
457
  const pronghornDotJson = require('../../pronghorn.json');
362
458
  assert.notEqual(-1, pronghornDotJson.id.indexOf('gcp_compute'));
459
+ assert.equal('Adapter', pronghornDotJson.type);
363
460
  assert.equal('GcpCompute', pronghornDotJson.export);
364
461
  assert.equal('GcpCompute', pronghornDotJson.title);
462
+ assert.equal('adapter.js', pronghornDotJson.src);
463
+ done();
464
+ } catch (error) {
465
+ log.error(`Test Failure: ${error}`);
466
+ done(error);
467
+ }
468
+ });
469
+ it('pronghorn.json should contain generic adapter methods', (done) => {
470
+ try {
471
+ const pronghornDotJson = require('../../pronghorn.json');
472
+ assert.notEqual(undefined, pronghornDotJson.methods);
473
+ assert.notEqual(null, pronghornDotJson.methods);
474
+ assert.notEqual('', pronghornDotJson.methods);
475
+ assert.equal(true, Array.isArray(pronghornDotJson.methods));
476
+ assert.notEqual(0, pronghornDotJson.methods.length);
477
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'updateAdapterConfiguration'));
478
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'findPath'));
479
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'troubleshoot'));
480
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runHealthcheck'));
481
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runConnectivity'));
482
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'runBasicGet'));
483
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'suspend'));
484
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'unsuspend'));
485
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'getQueue'));
486
+ assert.notEqual(undefined, pronghornDotJson.methods.find((e) => e.name === 'genericAdapterRequest'));
365
487
  done();
366
488
  } catch (error) {
367
489
  log.error(`Test Failure: ${error}`);
@@ -500,6 +622,117 @@ describe('[unit] GcpCompute Adapter Test', () => {
500
622
  try {
501
623
  const propertiesDotJson = require('../../propertiesSchema.json');
502
624
  assert.equal('adapter-gcp_compute', propertiesDotJson.$id);
625
+ assert.equal('object', propertiesDotJson.type);
626
+ assert.equal('http://json-schema.org/draft-07/schema#', propertiesDotJson.$schema);
627
+ done();
628
+ } catch (error) {
629
+ log.error(`Test Failure: ${error}`);
630
+ done(error);
631
+ }
632
+ });
633
+ it('propertiesSchema.json should contain generic adapter properties', (done) => {
634
+ try {
635
+ const propertiesDotJson = require('../../propertiesSchema.json');
636
+ assert.notEqual(undefined, propertiesDotJson.properties);
637
+ assert.notEqual(null, propertiesDotJson.properties);
638
+ assert.notEqual('', propertiesDotJson.properties);
639
+ assert.equal('string', propertiesDotJson.properties.host.type);
640
+ assert.equal('integer', propertiesDotJson.properties.port.type);
641
+ assert.equal('boolean', propertiesDotJson.properties.stub.type);
642
+ assert.notEqual(undefined, propertiesDotJson.definitions.authentication);
643
+ assert.notEqual(null, propertiesDotJson.definitions.authentication);
644
+ assert.notEqual('', propertiesDotJson.definitions.authentication);
645
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_method.type);
646
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.username.type);
647
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.password.type);
648
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token.type);
649
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.invalid_token_error.type);
650
+ assert.equal('integer', propertiesDotJson.definitions.authentication.properties.token_timeout.type);
651
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_cache.type);
652
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field.type));
653
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.authentication.properties.auth_field_format.type));
654
+ assert.equal('boolean', propertiesDotJson.definitions.authentication.properties.auth_logging.type);
655
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
656
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
657
+ assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
658
+ assert.notEqual('', propertiesDotJson.definitions.ssl);
659
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ecdhCurve.type);
660
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.enabled.type);
661
+ assert.equal('boolean', propertiesDotJson.definitions.ssl.properties.accept_invalid_cert.type);
662
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ca_file.type);
663
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.key_file.type);
664
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.cert_file.type);
665
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.secure_protocol.type);
666
+ assert.equal('string', propertiesDotJson.definitions.ssl.properties.ciphers.type);
667
+ assert.equal('string', propertiesDotJson.properties.base_path.type);
668
+ assert.equal('string', propertiesDotJson.properties.version.type);
669
+ assert.equal('string', propertiesDotJson.properties.cache_location.type);
670
+ assert.equal('boolean', propertiesDotJson.properties.encode_pathvars.type);
671
+ assert.equal(true, Array.isArray(propertiesDotJson.properties.save_metric.type));
672
+ assert.equal('string', propertiesDotJson.properties.protocol.type);
673
+ assert.notEqual(undefined, propertiesDotJson.definitions);
674
+ assert.notEqual(null, propertiesDotJson.definitions);
675
+ assert.notEqual('', propertiesDotJson.definitions);
676
+ assert.notEqual(undefined, propertiesDotJson.definitions.healthcheck);
677
+ assert.notEqual(null, propertiesDotJson.definitions.healthcheck);
678
+ assert.notEqual('', propertiesDotJson.definitions.healthcheck);
679
+ assert.equal('string', propertiesDotJson.definitions.healthcheck.properties.type.type);
680
+ assert.equal('integer', propertiesDotJson.definitions.healthcheck.properties.frequency.type);
681
+ assert.equal('object', propertiesDotJson.definitions.healthcheck.properties.query_object.type);
682
+ assert.notEqual(undefined, propertiesDotJson.definitions.throttle);
683
+ assert.notEqual(null, propertiesDotJson.definitions.throttle);
684
+ assert.notEqual('', propertiesDotJson.definitions.throttle);
685
+ assert.equal('boolean', propertiesDotJson.definitions.throttle.properties.throttle_enabled.type);
686
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.number_pronghorns.type);
687
+ assert.equal('string', propertiesDotJson.definitions.throttle.properties.sync_async.type);
688
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.max_in_queue.type);
689
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.concurrent_max.type);
690
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.expire_timeout.type);
691
+ assert.equal('integer', propertiesDotJson.definitions.throttle.properties.avg_runtime.type);
692
+ assert.equal('array', propertiesDotJson.definitions.throttle.properties.priorities.type);
693
+ assert.notEqual(undefined, propertiesDotJson.definitions.request);
694
+ assert.notEqual(null, propertiesDotJson.definitions.request);
695
+ assert.notEqual('', propertiesDotJson.definitions.request);
696
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_redirects.type);
697
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.number_retries.type);
698
+ assert.equal(true, Array.isArray(propertiesDotJson.definitions.request.properties.limit_retry_error.type));
699
+ assert.equal('array', propertiesDotJson.definitions.request.properties.failover_codes.type);
700
+ assert.equal('integer', propertiesDotJson.definitions.request.properties.attempt_timeout.type);
701
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.type);
702
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.payload.type);
703
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.uriOptions.type);
704
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.addlHeaders.type);
705
+ assert.equal('object', propertiesDotJson.definitions.request.properties.global_request.properties.authData.type);
706
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.healthcheck_on_timeout.type);
707
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_raw.type);
708
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.archiving.type);
709
+ assert.equal('boolean', propertiesDotJson.definitions.request.properties.return_request.type);
710
+ assert.notEqual(undefined, propertiesDotJson.definitions.proxy);
711
+ assert.notEqual(null, propertiesDotJson.definitions.proxy);
712
+ assert.notEqual('', propertiesDotJson.definitions.proxy);
713
+ assert.equal('boolean', propertiesDotJson.definitions.proxy.properties.enabled.type);
714
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.host.type);
715
+ assert.equal('integer', propertiesDotJson.definitions.proxy.properties.port.type);
716
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.protocol.type);
717
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.username.type);
718
+ assert.equal('string', propertiesDotJson.definitions.proxy.properties.password.type);
719
+ assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
720
+ assert.notEqual(null, propertiesDotJson.definitions.ssl);
721
+ assert.notEqual(undefined, propertiesDotJson.definitions.mongo);
722
+ assert.notEqual(null, propertiesDotJson.definitions.mongo);
723
+ assert.notEqual('', propertiesDotJson.definitions.mongo);
724
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.host.type);
725
+ assert.equal('integer', propertiesDotJson.definitions.mongo.properties.port.type);
726
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.database.type);
727
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.username.type);
728
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.password.type);
729
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.replSet.type);
730
+ assert.equal('object', propertiesDotJson.definitions.mongo.properties.db_ssl.type);
731
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.enabled.type);
732
+ assert.equal('boolean', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.accept_invalid_cert.type);
733
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.ca_file.type);
734
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
735
+ assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
503
736
  done();
504
737
  } catch (error) {
505
738
  log.error(`Test Failure: ${error}`);
@@ -520,6 +753,50 @@ describe('[unit] GcpCompute Adapter Test', () => {
520
753
  done(error);
521
754
  }
522
755
  });
756
+ it('error.json should have standard adapter errors', (done) => {
757
+ try {
758
+ const errorDotJson = require('../../error.json');
759
+ assert.notEqual(undefined, errorDotJson.errors);
760
+ assert.notEqual(null, errorDotJson.errors);
761
+ assert.notEqual('', errorDotJson.errors);
762
+ assert.equal(true, Array.isArray(errorDotJson.errors));
763
+ assert.notEqual(0, errorDotJson.errors.length);
764
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.100'));
765
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.101'));
766
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.102'));
767
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.110'));
768
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.111'));
769
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.112'));
770
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.113'));
771
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.114'));
772
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.115'));
773
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.116'));
774
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.300'));
775
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.301'));
776
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.302'));
777
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.303'));
778
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.304'));
779
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.305'));
780
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.310'));
781
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.311'));
782
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.312'));
783
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.320'));
784
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.321'));
785
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.400'));
786
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.401'));
787
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.402'));
788
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.500'));
789
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.501'));
790
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.502'));
791
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.503'));
792
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.600'));
793
+ assert.notEqual(undefined, errorDotJson.errors.find((e) => e.icode === 'AD.900'));
794
+ done();
795
+ } catch (error) {
796
+ log.error(`Test Failure: ${error}`);
797
+ done(error);
798
+ }
799
+ });
523
800
  });
524
801
 
525
802
  describe('sampleProperties.json', () => {
@@ -534,6 +811,119 @@ describe('[unit] GcpCompute Adapter Test', () => {
534
811
  done(error);
535
812
  }
536
813
  });
814
+ it('sampleProperties.json should contain generic adapter properties', (done) => {
815
+ try {
816
+ const sampleDotJson = require('../../sampleProperties.json');
817
+ assert.notEqual(-1, sampleDotJson.id.indexOf('gcp_compute'));
818
+ assert.equal('GcpCompute', sampleDotJson.type);
819
+ assert.notEqual(undefined, sampleDotJson.properties);
820
+ assert.notEqual(null, sampleDotJson.properties);
821
+ assert.notEqual('', sampleDotJson.properties);
822
+ assert.notEqual(undefined, sampleDotJson.properties.host);
823
+ assert.notEqual(undefined, sampleDotJson.properties.port);
824
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
825
+ assert.notEqual(undefined, sampleDotJson.properties.authentication);
826
+ assert.notEqual(null, sampleDotJson.properties.authentication);
827
+ assert.notEqual('', sampleDotJson.properties.authentication);
828
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_method);
829
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.username);
830
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.password);
831
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token);
832
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.invalid_token_error);
833
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_timeout);
834
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.token_cache);
835
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field);
836
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_field_format);
837
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_logging);
838
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
839
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
840
+ assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
841
+ assert.notEqual(undefined, sampleDotJson.properties.ssl);
842
+ assert.notEqual(null, sampleDotJson.properties.ssl);
843
+ assert.notEqual('', sampleDotJson.properties.ssl);
844
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ecdhCurve);
845
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.enabled);
846
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.accept_invalid_cert);
847
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ca_file);
848
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.key_file);
849
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.cert_file);
850
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.secure_protocol);
851
+ assert.notEqual(undefined, sampleDotJson.properties.ssl.ciphers);
852
+
853
+ assert.notEqual(undefined, sampleDotJson.properties.base_path);
854
+ assert.notEqual(undefined, sampleDotJson.properties.version);
855
+ assert.notEqual(undefined, sampleDotJson.properties.cache_location);
856
+ assert.notEqual(undefined, sampleDotJson.properties.encode_pathvars);
857
+ assert.notEqual(undefined, sampleDotJson.properties.save_metric);
858
+ assert.notEqual(undefined, sampleDotJson.properties.protocol);
859
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
860
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
861
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
862
+ assert.notEqual(undefined, sampleDotJson.properties.stub);
863
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck);
864
+ assert.notEqual(null, sampleDotJson.properties.healthcheck);
865
+ assert.notEqual('', sampleDotJson.properties.healthcheck);
866
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.type);
867
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.frequency);
868
+ assert.notEqual(undefined, sampleDotJson.properties.healthcheck.query_object);
869
+ assert.notEqual(undefined, sampleDotJson.properties.throttle);
870
+ assert.notEqual(null, sampleDotJson.properties.throttle);
871
+ assert.notEqual('', sampleDotJson.properties.throttle);
872
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.throttle_enabled);
873
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.number_pronghorns);
874
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.sync_async);
875
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.max_in_queue);
876
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.concurrent_max);
877
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.expire_timeout);
878
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.avg_runtime);
879
+ assert.notEqual(undefined, sampleDotJson.properties.throttle.priorities);
880
+ assert.notEqual(undefined, sampleDotJson.properties.request);
881
+ assert.notEqual(null, sampleDotJson.properties.request);
882
+ assert.notEqual('', sampleDotJson.properties.request);
883
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_redirects);
884
+ assert.notEqual(undefined, sampleDotJson.properties.request.number_retries);
885
+ assert.notEqual(undefined, sampleDotJson.properties.request.limit_retry_error);
886
+ assert.notEqual(undefined, sampleDotJson.properties.request.failover_codes);
887
+ assert.notEqual(undefined, sampleDotJson.properties.request.attempt_timeout);
888
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request);
889
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.payload);
890
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.uriOptions);
891
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.addlHeaders);
892
+ assert.notEqual(undefined, sampleDotJson.properties.request.global_request.authData);
893
+ assert.notEqual(undefined, sampleDotJson.properties.request.healthcheck_on_timeout);
894
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_raw);
895
+ assert.notEqual(undefined, sampleDotJson.properties.request.archiving);
896
+ assert.notEqual(undefined, sampleDotJson.properties.request.return_request);
897
+ assert.notEqual(undefined, sampleDotJson.properties.proxy);
898
+ assert.notEqual(null, sampleDotJson.properties.proxy);
899
+ assert.notEqual('', sampleDotJson.properties.proxy);
900
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.enabled);
901
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.host);
902
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.port);
903
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.protocol);
904
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.username);
905
+ assert.notEqual(undefined, sampleDotJson.properties.proxy.password);
906
+ assert.notEqual(undefined, sampleDotJson.properties.mongo);
907
+ assert.notEqual(null, sampleDotJson.properties.mongo);
908
+ assert.notEqual('', sampleDotJson.properties.mongo);
909
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.host);
910
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.port);
911
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.database);
912
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.username);
913
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.password);
914
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.replSet);
915
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl);
916
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.enabled);
917
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.accept_invalid_cert);
918
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.ca_file);
919
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.key_file);
920
+ assert.notEqual(undefined, sampleDotJson.properties.mongo.db_ssl.cert_file);
921
+ done();
922
+ } catch (error) {
923
+ log.error(`Test Failure: ${error}`);
924
+ done(error);
925
+ }
926
+ });
537
927
  });
538
928
 
539
929
  describe('#checkProperties', () => {
@@ -621,6 +1011,148 @@ describe('[unit] GcpCompute Adapter Test', () => {
621
1011
  });
622
1012
  });
623
1013
 
1014
+ describe('#updateAdapterConfiguration', () => {
1015
+ it('should have a updateAdapterConfiguration function', (done) => {
1016
+ try {
1017
+ assert.equal(true, typeof a.updateAdapterConfiguration === 'function');
1018
+ done();
1019
+ } catch (error) {
1020
+ log.error(`Test Failure: ${error}`);
1021
+ done(error);
1022
+ }
1023
+ });
1024
+ });
1025
+
1026
+ describe('#findPath', () => {
1027
+ it('should have a findPath function', (done) => {
1028
+ try {
1029
+ assert.equal(true, typeof a.findPath === 'function');
1030
+ done();
1031
+ } catch (error) {
1032
+ log.error(`Test Failure: ${error}`);
1033
+ done(error);
1034
+ }
1035
+ });
1036
+ it('findPath should find atleast one path that matches', (done) => {
1037
+ try {
1038
+ a.findPath('{base_path}/{version}', (data, error) => {
1039
+ try {
1040
+ assert.equal(undefined, error);
1041
+ assert.notEqual(undefined, data);
1042
+ assert.notEqual(null, data);
1043
+ assert.equal(true, data.found);
1044
+ assert.notEqual(undefined, data.foundIn);
1045
+ assert.notEqual(null, data.foundIn);
1046
+ assert.notEqual(0, data.foundIn.length);
1047
+ done();
1048
+ } catch (err) {
1049
+ log.error(`Test Failure: ${err}`);
1050
+ done(err);
1051
+ }
1052
+ });
1053
+ } catch (error) {
1054
+ log.error(`Adapter Exception: ${error}`);
1055
+ done(error);
1056
+ }
1057
+ }).timeout(attemptTimeout);
1058
+ });
1059
+
1060
+ describe('#suspend', () => {
1061
+ it('should have a suspend function', (done) => {
1062
+ try {
1063
+ assert.equal(true, typeof a.suspend === 'function');
1064
+ done();
1065
+ } catch (error) {
1066
+ log.error(`Test Failure: ${error}`);
1067
+ done(error);
1068
+ }
1069
+ });
1070
+ });
1071
+
1072
+ describe('#unsuspend', () => {
1073
+ it('should have a unsuspend function', (done) => {
1074
+ try {
1075
+ assert.equal(true, typeof a.unsuspend === 'function');
1076
+ done();
1077
+ } catch (error) {
1078
+ log.error(`Test Failure: ${error}`);
1079
+ done(error);
1080
+ }
1081
+ });
1082
+ });
1083
+
1084
+ describe('#getQueue', () => {
1085
+ it('should have a getQueue function', (done) => {
1086
+ try {
1087
+ assert.equal(true, typeof a.getQueue === 'function');
1088
+ done();
1089
+ } catch (error) {
1090
+ log.error(`Test Failure: ${error}`);
1091
+ done(error);
1092
+ }
1093
+ });
1094
+ });
1095
+
1096
+ describe('#troubleshoot', () => {
1097
+ it('should have a troubleshoot function', (done) => {
1098
+ try {
1099
+ assert.equal(true, typeof a.troubleshoot === 'function');
1100
+ done();
1101
+ } catch (error) {
1102
+ log.error(`Test Failure: ${error}`);
1103
+ done(error);
1104
+ }
1105
+ });
1106
+ });
1107
+
1108
+ describe('#runHealthcheck', () => {
1109
+ it('should have a runHealthcheck function', (done) => {
1110
+ try {
1111
+ assert.equal(true, typeof a.runHealthcheck === 'function');
1112
+ done();
1113
+ } catch (error) {
1114
+ log.error(`Test Failure: ${error}`);
1115
+ done(error);
1116
+ }
1117
+ });
1118
+ });
1119
+
1120
+ describe('#runConnectivity', () => {
1121
+ it('should have a runConnectivity function', (done) => {
1122
+ try {
1123
+ assert.equal(true, typeof a.runConnectivity === 'function');
1124
+ done();
1125
+ } catch (error) {
1126
+ log.error(`Test Failure: ${error}`);
1127
+ done(error);
1128
+ }
1129
+ });
1130
+ });
1131
+
1132
+ describe('#runBasicGet', () => {
1133
+ it('should have a runBasicGet function', (done) => {
1134
+ try {
1135
+ assert.equal(true, typeof a.runBasicGet === 'function');
1136
+ done();
1137
+ } catch (error) {
1138
+ log.error(`Test Failure: ${error}`);
1139
+ done(error);
1140
+ }
1141
+ });
1142
+ });
1143
+
1144
+ describe('#moveEntitiesToDB', () => {
1145
+ it('should have a moveEntitiesToDB function', (done) => {
1146
+ try {
1147
+ assert.equal(true, typeof a.moveEntitiesToDB === 'function');
1148
+ done();
1149
+ } catch (error) {
1150
+ log.error(`Test Failure: ${error}`);
1151
+ done(error);
1152
+ }
1153
+ });
1154
+ });
1155
+
624
1156
  describe('#checkActionFiles', () => {
625
1157
  it('should have a checkActionFiles function', (done) => {
626
1158
  try {
@@ -750,6 +1282,90 @@ describe('[unit] GcpCompute Adapter Test', () => {
750
1282
  // }).timeout(attemptTimeout);
751
1283
  // });
752
1284
 
1285
+ describe('#hasEntities', () => {
1286
+ it('should have a hasEntities function', (done) => {
1287
+ try {
1288
+ assert.equal(true, typeof a.hasEntities === 'function');
1289
+ done();
1290
+ } catch (error) {
1291
+ log.error(`Test Failure: ${error}`);
1292
+ done(error);
1293
+ }
1294
+ });
1295
+ });
1296
+
1297
+ describe('#hasDevices', () => {
1298
+ it('should have a hasDevices function', (done) => {
1299
+ try {
1300
+ assert.equal(true, typeof a.hasDevices === 'function');
1301
+ done();
1302
+ } catch (error) {
1303
+ log.error(`Test Failure: ${error}`);
1304
+ done(error);
1305
+ }
1306
+ });
1307
+ });
1308
+
1309
+ describe('#getDevice', () => {
1310
+ it('should have a getDevice function', (done) => {
1311
+ try {
1312
+ assert.equal(true, typeof a.getDevice === 'function');
1313
+ done();
1314
+ } catch (error) {
1315
+ log.error(`Test Failure: ${error}`);
1316
+ done(error);
1317
+ }
1318
+ });
1319
+ });
1320
+
1321
+ describe('#getDevicesFiltered', () => {
1322
+ it('should have a getDevicesFiltered function', (done) => {
1323
+ try {
1324
+ assert.equal(true, typeof a.getDevicesFiltered === 'function');
1325
+ done();
1326
+ } catch (error) {
1327
+ log.error(`Test Failure: ${error}`);
1328
+ done(error);
1329
+ }
1330
+ });
1331
+ });
1332
+
1333
+ describe('#isAlive', () => {
1334
+ it('should have a isAlive function', (done) => {
1335
+ try {
1336
+ assert.equal(true, typeof a.isAlive === 'function');
1337
+ done();
1338
+ } catch (error) {
1339
+ log.error(`Test Failure: ${error}`);
1340
+ done(error);
1341
+ }
1342
+ });
1343
+ });
1344
+
1345
+ describe('#getConfig', () => {
1346
+ it('should have a getConfig function', (done) => {
1347
+ try {
1348
+ assert.equal(true, typeof a.getConfig === 'function');
1349
+ done();
1350
+ } catch (error) {
1351
+ log.error(`Test Failure: ${error}`);
1352
+ done(error);
1353
+ }
1354
+ });
1355
+ });
1356
+
1357
+ describe('#getCount', () => {
1358
+ it('should have a getCount function', (done) => {
1359
+ try {
1360
+ assert.equal(true, typeof a.getCount === 'function');
1361
+ done();
1362
+ } catch (error) {
1363
+ log.error(`Test Failure: ${error}`);
1364
+ done(error);
1365
+ }
1366
+ });
1367
+ });
1368
+
753
1369
  /*
754
1370
  -----------------------------------------------------------------------
755
1371
  -----------------------------------------------------------------------
@@ -27921,5 +28537,505 @@ describe('[unit] GcpCompute Adapter Test', () => {
27921
28537
  }
27922
28538
  }).timeout(attemptTimeout);
27923
28539
  });
28540
+
28541
+ describe('#addFirewallPolicyAssociation - errors', () => {
28542
+ it('should have a addFirewallPolicyAssociation function', (done) => {
28543
+ assert.equal(true, typeof a.addFirewallPolicyAssociation === 'function');
28544
+ done();
28545
+ });
28546
+ it('should error on addFirewallPolicyAssociation - no resourceId', (done) => {
28547
+ try {
28548
+ a.addFirewallPolicyAssociation(null, null, null, null, (data, error) => {
28549
+ try {
28550
+ const displayE = 'resourceId is required';
28551
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-addFirewallPolicyAssociation', displayE);
28552
+ done();
28553
+ } catch (ex) {
28554
+ log.error(`Test Failure: ${ex}`);
28555
+ done(ex);
28556
+ }
28557
+ });
28558
+ } catch (exc) {
28559
+ log.error(`Adapter Exception: ${exc}`);
28560
+ done(exc);
28561
+ }
28562
+ }).timeout(attemptTimeout);
28563
+ it('should error on addFirewallPolicyAssociation - missing association', (done) => {
28564
+ try {
28565
+ a.addFirewallPolicyAssociation('fakedata', null, null, null, (data, error) => {
28566
+ try {
28567
+ const displayE = 'association is required';
28568
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-addFirewallPolicyAssociation', displayE);
28569
+ done();
28570
+ } catch (ex) {
28571
+ log.error(`Test Failure: ${ex}`);
28572
+ done(ex);
28573
+ }
28574
+ });
28575
+ } catch (exc) {
28576
+ log.error(`Adapter Exception: ${exc}`);
28577
+ done(exc);
28578
+ }
28579
+ }).timeout(attemptTimeout);
28580
+ });
28581
+
28582
+ describe('#addFirewallPolicyRule - errors', () => {
28583
+ it('should have a addFirewallPolicyRule function', (done) => {
28584
+ assert.equal(true, typeof a.addFirewallPolicyRule === 'function');
28585
+ done();
28586
+ });
28587
+ it('should error on addFirewallPolicyRule - no resourceId', (done) => {
28588
+ try {
28589
+ a.addFirewallPolicyRule(null, null, null, (data, error) => {
28590
+ try {
28591
+ const displayE = 'resourceId is required';
28592
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-addFirewallPolicyRule', displayE);
28593
+ done();
28594
+ } catch (ex) {
28595
+ log.error(`Test Failure: ${ex}`);
28596
+ done(ex);
28597
+ }
28598
+ });
28599
+ } catch (exc) {
28600
+ log.error(`Adapter Exception: ${exc}`);
28601
+ done(exc);
28602
+ }
28603
+ }).timeout(attemptTimeout);
28604
+ it('should error on addFirewallPolicyRule - missing rule', (done) => {
28605
+ try {
28606
+ a.addFirewallPolicyRule('fakedata', null, null, (data, error) => {
28607
+ try {
28608
+ const displayE = 'rule is required';
28609
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-addFirewallPolicyRule', displayE);
28610
+ done();
28611
+ } catch (ex) {
28612
+ log.error(`Test Failure: ${ex}`);
28613
+ done(ex);
28614
+ }
28615
+ });
28616
+ } catch (exc) {
28617
+ log.error(`Adapter Exception: ${exc}`);
28618
+ done(exc);
28619
+ }
28620
+ }).timeout(attemptTimeout);
28621
+ });
28622
+
28623
+ describe('#cloneFirewallPolicyRule - errors', () => {
28624
+ it('should have a cloneFirewallPolicyRule function', (done) => {
28625
+ assert.equal(true, typeof a.cloneFirewallPolicyRule === 'function');
28626
+ done();
28627
+ });
28628
+ it('should error on cloneFirewallPolicyRule - no resourceId', (done) => {
28629
+ try {
28630
+ a.cloneFirewallPolicyRule(null, null, null, (data, error) => {
28631
+ try {
28632
+ const displayE = 'resourceId is required';
28633
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-cloneFirewallPolicyRule', displayE);
28634
+ done();
28635
+ } catch (ex) {
28636
+ log.error(`Test Failure: ${ex}`);
28637
+ done(ex);
28638
+ }
28639
+ });
28640
+ } catch (exc) {
28641
+ log.error(`Adapter Exception: ${exc}`);
28642
+ done(exc);
28643
+ }
28644
+ }).timeout(attemptTimeout);
28645
+ });
28646
+
28647
+ describe('#deleteFirewallPolicy - errors', () => {
28648
+ it('should have a deleteFirewallPolicy function', (done) => {
28649
+ assert.equal(true, typeof a.deleteFirewallPolicy === 'function');
28650
+ done();
28651
+ });
28652
+ it('should error on deleteFirewallPolicy - no resourceId', (done) => {
28653
+ try {
28654
+ a.deleteFirewallPolicy(null, null, (data, error) => {
28655
+ try {
28656
+ const displayE = 'resourceId is required';
28657
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-deleteFirewallPolicy', displayE);
28658
+ done();
28659
+ } catch (ex) {
28660
+ log.error(`Test Failure: ${ex}`);
28661
+ done(ex);
28662
+ }
28663
+ });
28664
+ } catch (exc) {
28665
+ log.error(`Adapter Exception: ${exc}`);
28666
+ done(exc);
28667
+ }
28668
+ }).timeout(attemptTimeout);
28669
+ });
28670
+
28671
+ describe('#getFirewallPolicy - errors', () => {
28672
+ it('should have a getFirewallPolicy function', (done) => {
28673
+ assert.equal(true, typeof a.getFirewallPolicy === 'function');
28674
+ done();
28675
+ });
28676
+ it('should error on getFirewallPolicy - no resourceId', (done) => {
28677
+ try {
28678
+ a.getFirewallPolicy(null, (data, error) => {
28679
+ try {
28680
+ const displayE = 'resourceId is required';
28681
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-getFirewallPolicy', displayE);
28682
+ done();
28683
+ } catch (ex) {
28684
+ log.error(`Test Failure: ${ex}`);
28685
+ done(ex);
28686
+ }
28687
+ });
28688
+ } catch (exc) {
28689
+ log.error(`Adapter Exception: ${exc}`);
28690
+ done(exc);
28691
+ }
28692
+ }).timeout(attemptTimeout);
28693
+ });
28694
+
28695
+ describe('#getFirewallPolicyAssociation - errors', () => {
28696
+ it('should have a getFirewallPolicyAssociation function', (done) => {
28697
+ assert.equal(true, typeof a.getFirewallPolicyAssociation === 'function');
28698
+ done();
28699
+ });
28700
+ it('should error on getFirewallPolicyAssociation - no resourceId', (done) => {
28701
+ try {
28702
+ a.getFirewallPolicyAssociation(null, null, (data, error) => {
28703
+ try {
28704
+ const displayE = 'resourceId is required';
28705
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-getFirewallPolicyAssociation', displayE);
28706
+ done();
28707
+ } catch (ex) {
28708
+ log.error(`Test Failure: ${ex}`);
28709
+ done(ex);
28710
+ }
28711
+ });
28712
+ } catch (exc) {
28713
+ log.error(`Adapter Exception: ${exc}`);
28714
+ done(exc);
28715
+ }
28716
+ }).timeout(attemptTimeout);
28717
+ });
28718
+
28719
+ describe('#getFirewallPolicyIamPolicy - errors', () => {
28720
+ it('should have a getFirewallPolicyIamPolicy function', (done) => {
28721
+ assert.equal(true, typeof a.getFirewallPolicyIamPolicy === 'function');
28722
+ done();
28723
+ });
28724
+ it('should error on getFirewallPolicyIamPolicy - no resourceId', (done) => {
28725
+ try {
28726
+ a.getFirewallPolicyIamPolicy(null, null, (data, error) => {
28727
+ try {
28728
+ const displayE = 'resourceId is required';
28729
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-getFirewallPolicyIamPolicy', displayE);
28730
+ done();
28731
+ } catch (ex) {
28732
+ log.error(`Test Failure: ${ex}`);
28733
+ done(ex);
28734
+ }
28735
+ });
28736
+ } catch (exc) {
28737
+ log.error(`Adapter Exception: ${exc}`);
28738
+ done(exc);
28739
+ }
28740
+ }).timeout(attemptTimeout);
28741
+ });
28742
+
28743
+ describe('#getFirewallPolicyRule - errors', () => {
28744
+ it('should have a getFirewallPolicyRule function', (done) => {
28745
+ assert.equal(true, typeof a.getFirewallPolicyRule === 'function');
28746
+ done();
28747
+ });
28748
+ it('should error on getFirewallPolicyRule - no resourceId', (done) => {
28749
+ try {
28750
+ a.getFirewallPolicyRule(null, null, (data, error) => {
28751
+ try {
28752
+ const displayE = 'resourceId is required';
28753
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-getFirewallPolicyRule', displayE);
28754
+ done();
28755
+ } catch (ex) {
28756
+ log.error(`Test Failure: ${ex}`);
28757
+ done(ex);
28758
+ }
28759
+ });
28760
+ } catch (exc) {
28761
+ log.error(`Adapter Exception: ${exc}`);
28762
+ done(exc);
28763
+ }
28764
+ }).timeout(attemptTimeout);
28765
+ });
28766
+
28767
+ describe('#insertFirewallPolicy - errors', () => {
28768
+ it('should have a insertFirewallPolicy function', (done) => {
28769
+ assert.equal(true, typeof a.insertFirewallPolicy === 'function');
28770
+ done();
28771
+ });
28772
+ it('should error on insertFirewallPolicy - no policy', (done) => {
28773
+ try {
28774
+ a.insertFirewallPolicy(null, null, null, (data, error) => {
28775
+ try {
28776
+ const displayE = 'policy is required';
28777
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-insertFirewallPolicy', displayE);
28778
+ done();
28779
+ } catch (ex) {
28780
+ log.error(`Test Failure: ${ex}`);
28781
+ done(ex);
28782
+ }
28783
+ });
28784
+ } catch (exc) {
28785
+ log.error(`Adapter Exception: ${exc}`);
28786
+ done(exc);
28787
+ }
28788
+ }).timeout(attemptTimeout);
28789
+ });
28790
+
28791
+ describe('#listFirewallPolicy - errors', () => {
28792
+ it('should have a listFirewallPolicy function', (done) => {
28793
+ assert.equal(true, typeof a.listFirewallPolicy === 'function');
28794
+ done();
28795
+ });
28796
+ });
28797
+
28798
+ describe('#listFirewallPolicyAssociations - errors', () => {
28799
+ it('should have a listFirewallPolicyAssociations function', (done) => {
28800
+ assert.equal(true, typeof a.listFirewallPolicyAssociations === 'function');
28801
+ done();
28802
+ });
28803
+ });
28804
+
28805
+ describe('#moveFirewallPolicy - errors', () => {
28806
+ it('should have a moveFirewallPolicy function', (done) => {
28807
+ assert.equal(true, typeof a.moveFirewallPolicy === 'function');
28808
+ done();
28809
+ });
28810
+ it('should error on moveFirewallPolicy - no resourceId', (done) => {
28811
+ try {
28812
+ a.moveFirewallPolicy(null, null, null, (data, error) => {
28813
+ try {
28814
+ const displayE = 'resourceId is required';
28815
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-moveFirewallPolicy', displayE);
28816
+ done();
28817
+ } catch (ex) {
28818
+ log.error(`Test Failure: ${ex}`);
28819
+ done(ex);
28820
+ }
28821
+ });
28822
+ } catch (exc) {
28823
+ log.error(`Adapter Exception: ${exc}`);
28824
+ done(exc);
28825
+ }
28826
+ }).timeout(attemptTimeout);
28827
+ });
28828
+
28829
+ describe('#patchFirewallPolicy - errors', () => {
28830
+ it('should have a patchFirewallPolicy function', (done) => {
28831
+ assert.equal(true, typeof a.patchFirewallPolicy === 'function');
28832
+ done();
28833
+ });
28834
+ it('should error on patchFirewallPolicy - no resourceId', (done) => {
28835
+ try {
28836
+ a.patchFirewallPolicy(null, null, null, (data, error) => {
28837
+ try {
28838
+ const displayE = 'resourceId is required';
28839
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-patchFirewallPolicy', displayE);
28840
+ done();
28841
+ } catch (ex) {
28842
+ log.error(`Test Failure: ${ex}`);
28843
+ done(ex);
28844
+ }
28845
+ });
28846
+ } catch (exc) {
28847
+ log.error(`Adapter Exception: ${exc}`);
28848
+ done(exc);
28849
+ }
28850
+ }).timeout(attemptTimeout);
28851
+ it('should error on patchFirewallPolicy - no policy', (done) => {
28852
+ try {
28853
+ a.patchFirewallPolicy('fakedata', null, null, (data, error) => {
28854
+ try {
28855
+ const displayE = 'policy is required';
28856
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-patchFirewallPolicy', displayE);
28857
+ done();
28858
+ } catch (ex) {
28859
+ log.error(`Test Failure: ${ex}`);
28860
+ done(ex);
28861
+ }
28862
+ });
28863
+ } catch (exc) {
28864
+ log.error(`Adapter Exception: ${exc}`);
28865
+ done(exc);
28866
+ }
28867
+ }).timeout(attemptTimeout);
28868
+ });
28869
+
28870
+ describe('#patchFirewallPolicyRule - errors', () => {
28871
+ it('should have a patchFirewallPolicyRule function', (done) => {
28872
+ assert.equal(true, typeof a.patchFirewallPolicyRule === 'function');
28873
+ done();
28874
+ });
28875
+ it('should error on patchFirewallPolicyRule - no resourceId', (done) => {
28876
+ try {
28877
+ a.patchFirewallPolicyRule(null, null, null, null, (data, error) => {
28878
+ try {
28879
+ const displayE = 'resourceId is required';
28880
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-patchFirewallPolicyRule', displayE);
28881
+ done();
28882
+ } catch (ex) {
28883
+ log.error(`Test Failure: ${ex}`);
28884
+ done(ex);
28885
+ }
28886
+ });
28887
+ } catch (exc) {
28888
+ log.error(`Adapter Exception: ${exc}`);
28889
+ done(exc);
28890
+ }
28891
+ }).timeout(attemptTimeout);
28892
+ it('should error on patchFirewallPolicyRule - no rule', (done) => {
28893
+ try {
28894
+ a.patchFirewallPolicyRule('fakedata', null, null, null, (data, error) => {
28895
+ try {
28896
+ const displayE = 'rule is required';
28897
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-patchFirewallPolicyRule', displayE);
28898
+ done();
28899
+ } catch (ex) {
28900
+ log.error(`Test Failure: ${ex}`);
28901
+ done(ex);
28902
+ }
28903
+ });
28904
+ } catch (exc) {
28905
+ log.error(`Adapter Exception: ${exc}`);
28906
+ done(exc);
28907
+ }
28908
+ }).timeout(attemptTimeout);
28909
+ });
28910
+
28911
+ describe('#removeFirewallPolicyAssociation - errors', () => {
28912
+ it('should have a removeFirewallPolicyAssociation function', (done) => {
28913
+ assert.equal(true, typeof a.removeFirewallPolicyAssociation === 'function');
28914
+ done();
28915
+ });
28916
+ it('should error on removeFirewallPolicyAssociation - no resourceId', (done) => {
28917
+ try {
28918
+ a.removeFirewallPolicyAssociation(null, null, null, (data, error) => {
28919
+ try {
28920
+ const displayE = 'resourceId is required';
28921
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-removeFirewallPolicyAssociation', displayE);
28922
+ done();
28923
+ } catch (ex) {
28924
+ log.error(`Test Failure: ${ex}`);
28925
+ done(ex);
28926
+ }
28927
+ });
28928
+ } catch (exc) {
28929
+ log.error(`Adapter Exception: ${exc}`);
28930
+ done(exc);
28931
+ }
28932
+ }).timeout(attemptTimeout);
28933
+ });
28934
+
28935
+ describe('#removeFirewallPolicyRule - errors', () => {
28936
+ it('should have a removeFirewallPolicyRule function', (done) => {
28937
+ assert.equal(true, typeof a.removeFirewallPolicyRule === 'function');
28938
+ done();
28939
+ });
28940
+ it('should error on removeFirewallPolicyRule - no resourceId', (done) => {
28941
+ try {
28942
+ a.removeFirewallPolicyRule(null, null, null, (data, error) => {
28943
+ try {
28944
+ const displayE = 'resourceId is required';
28945
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-removeFirewallPolicyRule', displayE);
28946
+ done();
28947
+ } catch (ex) {
28948
+ log.error(`Test Failure: ${ex}`);
28949
+ done(ex);
28950
+ }
28951
+ });
28952
+ } catch (exc) {
28953
+ log.error(`Adapter Exception: ${exc}`);
28954
+ done(exc);
28955
+ }
28956
+ }).timeout(attemptTimeout);
28957
+ });
28958
+
28959
+ describe('#setFirewallPolicyIamPolicy - errors', () => {
28960
+ it('should have a setFirewallPolicyIamPolicy function', (done) => {
28961
+ assert.equal(true, typeof a.setFirewallPolicyIamPolicy === 'function');
28962
+ done();
28963
+ });
28964
+ it('should error on setFirewallPolicyIamPolicy - no resourceId', (done) => {
28965
+ try {
28966
+ a.setFirewallPolicyIamPolicy(null, null, (data, error) => {
28967
+ try {
28968
+ const displayE = 'resourceId is required';
28969
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-setFirewallPolicyIamPolicy', displayE);
28970
+ done();
28971
+ } catch (ex) {
28972
+ log.error(`Test Failure: ${ex}`);
28973
+ done(ex);
28974
+ }
28975
+ });
28976
+ } catch (exc) {
28977
+ log.error(`Adapter Exception: ${exc}`);
28978
+ done(exc);
28979
+ }
28980
+ }).timeout(attemptTimeout);
28981
+ it('should error on setFirewallPolicyIamPolicy - no iamPolicy', (done) => {
28982
+ try {
28983
+ a.setFirewallPolicyIamPolicy('fakedata', null, (data, error) => {
28984
+ try {
28985
+ const displayE = 'iamPolicy is required';
28986
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-setFirewallPolicyIamPolicy', displayE);
28987
+ done();
28988
+ } catch (ex) {
28989
+ log.error(`Test Failure: ${ex}`);
28990
+ done(ex);
28991
+ }
28992
+ });
28993
+ } catch (exc) {
28994
+ log.error(`Adapter Exception: ${exc}`);
28995
+ done(exc);
28996
+ }
28997
+ }).timeout(attemptTimeout);
28998
+ });
28999
+
29000
+ describe('#testFirewallPolicyIamPermissions - errors', () => {
29001
+ it('should have a testFirewallPolicyIamPermissions function', (done) => {
29002
+ assert.equal(true, typeof a.testFirewallPolicyIamPermissions === 'function');
29003
+ done();
29004
+ });
29005
+ it('should error on testFirewallPolicyIamPermissions - no resourceId', (done) => {
29006
+ try {
29007
+ a.testFirewallPolicyIamPermissions(null, null, (data, error) => {
29008
+ try {
29009
+ const displayE = 'resourceId is required';
29010
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-testFirewallPolicyIamPermissions', displayE);
29011
+ done();
29012
+ } catch (ex) {
29013
+ log.error(`Test Failure: ${ex}`);
29014
+ done(ex);
29015
+ }
29016
+ });
29017
+ } catch (exc) {
29018
+ log.error(`Adapter Exception: ${exc}`);
29019
+ done(exc);
29020
+ }
29021
+ }).timeout(attemptTimeout);
29022
+ it('should error on testFirewallPolicyIamPermissions - no iamPolicy', (done) => {
29023
+ try {
29024
+ a.testFirewallPolicyIamPermissions('fakedata', null, (data, error) => {
29025
+ try {
29026
+ const displayE = 'iamPolicy is required';
29027
+ runErrorAsserts(data, error, 'AD.300', 'Test-gcp_compute-adapter-testFirewallPolicyIamPermissions', displayE);
29028
+ done();
29029
+ } catch (ex) {
29030
+ log.error(`Test Failure: ${ex}`);
29031
+ done(ex);
29032
+ }
29033
+ });
29034
+ } catch (exc) {
29035
+ log.error(`Adapter Exception: ${exc}`);
29036
+ done(exc);
29037
+ }
29038
+ }).timeout(attemptTimeout);
29039
+ });
27924
29040
  });
27925
29041
  });