@itentialopensource/adapter-winston_syslog 1.2.5 → 1.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.
Files changed (44) hide show
  1. package/.eslintrc.js +1 -0
  2. package/AUTH.md +1 -1
  3. package/BROKER.md +4 -4
  4. package/CALLS.md +8 -8
  5. package/ENHANCE.md +3 -3
  6. package/PROPERTIES.md +24 -9
  7. package/README.md +24 -23
  8. package/SUMMARY.md +2 -2
  9. package/SYSTEMINFO.md +1 -1
  10. package/TAB1.md +2 -2
  11. package/TAB2.md +6 -2
  12. package/TROUBLESHOOT.md +10 -1
  13. package/UTILITIES.md +473 -0
  14. package/adapter.js +5 -5
  15. package/adapterBase.js +52 -16
  16. package/package.json +26 -30
  17. package/pronghorn.json +17 -15
  18. package/propertiesSchema.json +68 -7
  19. package/report/adapterInfo.json +7 -7
  20. package/report/updateReport1748551891579.json +120 -0
  21. package/sampleProperties.json +4 -0
  22. package/test/integration/adapterTestBasicGet.js +88 -54
  23. package/test/integration/adapterTestConnectivity.js +15 -16
  24. package/test/integration/adapterTestIntegration.js +1 -38
  25. package/test/unit/adapterBaseTestUnit.js +641 -39
  26. package/test/unit/adapterTestUnit.js +17 -54
  27. package/utils/adapterInfo.js +114 -164
  28. package/utils/argParser.js +44 -0
  29. package/utils/checkMigrate.js +77 -38
  30. package/utils/entitiesToDB.js +53 -42
  31. package/utils/logger.js +26 -0
  32. package/utils/modify.js +56 -55
  33. package/utils/mongoDbConnection.js +79 -0
  34. package/utils/mongoUtils.js +162 -0
  35. package/utils/taskMover.js +31 -32
  36. package/utils/tbScript.js +36 -172
  37. package/utils/tbUtils.js +84 -226
  38. package/utils/troubleshootingAdapter.js +68 -84
  39. package/utils/updateAdapterConfig.js +158 -0
  40. package/utils/addAuth.js +0 -94
  41. package/utils/artifactize.js +0 -146
  42. package/utils/basicGet.js +0 -50
  43. package/utils/packModificationScript.js +0 -35
  44. package/utils/patches2bundledDeps.js +0 -90
@@ -7,14 +7,11 @@ const assert = require('assert');
7
7
  const https = require('https');
8
8
  const mocha = require('mocha');
9
9
  const ping = require('ping');
10
- const dnsLookup = require('dns-lookup-promise');
10
+ const dns = require('dns');
11
+ const { parseArgs } = require('../../utils/argParser');
11
12
 
12
- let host;
13
- process.argv.forEach((val) => {
14
- if (val.indexOf('--HOST') === 0) {
15
- [, host] = val.split('=');
16
- }
17
- });
13
+ const dnsPromises = dns.promises;
14
+ const { host } = parseArgs();
18
15
 
19
16
  describe('[integration] Adapter Test', () => {
20
17
  context(`Testing network connection on ${host}`, () => {
@@ -23,10 +20,10 @@ describe('[integration] Adapter Test', () => {
23
20
  });
24
21
 
25
22
  it('DNS resolve', (done) => {
26
- dnsLookup(host)
27
- .then((addresses) => {
23
+ dnsPromises.lookup(host, { all: true })
24
+ .then((result) => {
28
25
  try {
29
- assert.ok(addresses.length > 0);
26
+ assert.ok(result.length > 0);
30
27
  done();
31
28
  } catch (error) {
32
29
  done(error);
@@ -78,12 +75,13 @@ describe('[integration] Adapter Test', () => {
78
75
  it('Support IPv4', (done) => {
79
76
  const options = {
80
77
  family: 4,
81
- hints: dnsLookup.ADDRCONFIG
78
+ hints: dns.ADDRCONFIG
82
79
  };
83
80
 
84
- dnsLookup.lookup(host, options)
85
- .then((address, family) => {
81
+ dnsPromises.lookup(host, options)
82
+ .then((result) => {
86
83
  try {
84
+ const { address, family } = result;
87
85
  assert.ok(address !== null && family === 4);
88
86
  done();
89
87
  } catch (error) {
@@ -98,12 +96,13 @@ describe('[integration] Adapter Test', () => {
98
96
  it('Support IPv6', (done) => {
99
97
  const options = {
100
98
  family: 6,
101
- hints: dnsLookup.ADDRCONFIG
99
+ hints: dns.ADDRCONFIG
102
100
  };
103
101
 
104
- dnsLookup.lookup(host, options)
105
- .then((address, family) => {
102
+ dnsPromises.lookup(host, options)
103
+ .then((result) => {
106
104
  try {
105
+ const { address, family } = result;
107
106
  assert.ok(address !== null && family === 6);
108
107
  done();
109
108
  } catch (error) {
@@ -16,11 +16,11 @@ const winston = require('winston');
16
16
  const { expect } = require('chai');
17
17
  const { use } = require('chai');
18
18
  const td = require('testdouble');
19
+ const log = require('../../utils/logger');
19
20
 
20
21
  const anything = td.matchers.anything();
21
22
 
22
23
  // stub and attemptTimeout are used throughout the code so set them here
23
- let logLevel = 'none';
24
24
  const isRapidFail = false;
25
25
  const isSaveMockData = false;
26
26
 
@@ -71,43 +71,6 @@ global.pronghornProps = {
71
71
 
72
72
  global.$HOME = `${__dirname}/../..`;
73
73
 
74
- // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
75
- // this you may error on log.trace calls.
76
- const myCustomLevels = {
77
- levels: {
78
- spam: 6,
79
- trace: 5,
80
- debug: 4,
81
- info: 3,
82
- warn: 2,
83
- error: 1,
84
- none: 0
85
- }
86
- };
87
-
88
- // need to see if there is a log level passed in
89
- process.argv.forEach((val) => {
90
- // is there a log level defined to be passed in?
91
- if (val.indexOf('--LOG') === 0) {
92
- // get the desired log level
93
- const inputVal = val.split('=')[1];
94
-
95
- // validate the log level is supported, if so set it
96
- if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
97
- logLevel = inputVal;
98
- }
99
- }
100
- });
101
-
102
- // need to set global logging
103
- global.log = winston.createLogger({
104
- level: logLevel,
105
- levels: myCustomLevels.levels,
106
- transports: [
107
- new winston.transports.Console()
108
- ]
109
- });
110
-
111
74
  /**
112
75
  * Runs the common asserts for test
113
76
  */