Skip to content

Commit

Permalink
Merge pull request #2500 from artilleryio/bernardobridge/art-1643-rev…
Browse files Browse the repository at this point in the history
…iew-vulnerabilities-from-repo-and-resolve-pending-issues

dep: stop using ip package
  • Loading branch information
bernardobridge committed Feb 19, 2024
2 parents db4ca95 + b48d325 commit 3f45ead
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 378 deletions.
368 changes: 9 additions & 359 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions packages/artillery-engine-playwright/test/fargate.aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,22 @@ test('playwright typescript test works and reports data', async (t) => {
const output =
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput} --overrides ${configOverride} --tags ${tags} --record`;

t.equal(output.exitCode, 0);
t.equal(
output.exitCode,
0,
`should have exit code 0, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
).aggregate;

//Assert: should have no failed VUs
t.equal(jsonReportAggregate.counters['vusers.failed'], 0);
t.equal(
jsonReportAggregate.counters['vusers.failed'],
0,
'should have no failed VUs'
);

//Assert: should have done http_requests and reported codes
t.ok(
Expand Down Expand Up @@ -113,7 +121,11 @@ test('playwright typescript test fails and has correct vu count when expectation
try {
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput} --overrides ${scenarioOverride} --tags ${tags} --record`;
} catch (output) {
t.equal(output.exitCode, 1);
t.equal(
output.exitCode,
1,
`should have exit code 1, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
Expand Down
36 changes: 30 additions & 6 deletions packages/artillery-engine-playwright/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ test('playwright js test works and reports data', async (t) => {
const output =
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput}`;

t.equal(output.exitCode, 0);
t.equal(
output.exitCode,
0,
`should have exit code 0, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
).aggregate;

//Assert: should have no failed VUs
t.equal(jsonReportAggregate.counters['vusers.failed'], 0);
t.equal(
jsonReportAggregate.counters['vusers.failed'],
0,
'should have no failed VUs'
);

//Assert: should have done http_requests and reported codes
t.ok(
Expand Down Expand Up @@ -105,7 +113,11 @@ test('playwright js test fails and has correct vu count when expectation fails',
try {
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput} --overrides ${scenarioOverride}`;
} catch (output) {
t.equal(output.exitCode, 1);
t.equal(
output.exitCode,
1,
`should have exit code 1, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
Expand All @@ -131,14 +143,22 @@ test('playwright typescript test works and reports data', async (t) => {
const output =
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput} --overrides ${configOverride}`;

t.equal(output.exitCode, 0);
t.equal(
output.exitCode,
0,
`should have exit code 0, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
).aggregate;

//Assert: should have no failed VUs
t.equal(jsonReportAggregate.counters['vusers.failed'], 0);
t.equal(
jsonReportAggregate.counters['vusers.failed'],
0,
'should have no failed VUs'
);

//Assert: should have done http_requests and reported codes
t.ok(
Expand Down Expand Up @@ -222,7 +242,11 @@ test('playwright typescript test fails and has correct vu count when expectation
try {
await $`../artillery/bin/run run ./test/fixtures/pw-acceptance.yml --output ${playwrightOutput} --overrides ${scenarioOverride}`;
} catch (output) {
t.equal(output.exitCode, 1);
t.equal(
output.exitCode,
1,
`should have exit code 1, got ${output.exitCode}`
);

const jsonReportAggregate = JSON.parse(
fs.readFileSync(playwrightOutput, 'utf8')
Expand Down
1 change: 0 additions & 1 deletion packages/artillery-plugin-publish-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"debug": "^4.1.1",
"dogapi": "^2.8.4",
"hot-shots": "^6.0.1",
"libhoney": "^4.1.0",
"lightstep-tracer": "^0.31.0",
"mixpanel": "^0.13.0",
"opentracing": "^0.14.5",
Expand Down
23 changes: 17 additions & 6 deletions packages/artillery/lib/cmds/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const {
const p = require('util').promisify;
const csv = require('csv-parse');
const debug = require('debug')('commands:run');
const ip = require('ip');
const dotenv = require('dotenv');
const _ = require('lodash');

Expand Down Expand Up @@ -586,21 +585,33 @@ async function sendTelemetry(script, flags, extraProps) {
properties.distinctId = properties.targetHash;
}

const ipaddr = ip.address();
let macaddr;
const nonInternalIpv6Interfaces = [];
for (const [iface, descrs] of Object.entries(os.networkInterfaces())) {
for (const o of descrs) {
if (o.address === ipaddr) {
macaddr = o.mac;
break;
if (o.internal == true) {
continue;
}

//prefer ipv4 interface when available
if (o.family != 'IPv4') {
nonInternalIpv6Interfaces.push(o);
continue;
}

macaddr = o.mac;
break;
}
}

//default to first ipv6 interface if no ipv4 interface is available
if (!macaddr && nonInternalIpv6Interfaces.length > 0) {
macaddr = nonInternalIpv6Interfaces[0].mac;
}

if (macaddr) {
properties.macHash = hash(macaddr);
}
properties.ipHash = hash(ipaddr);
properties.hostnameHash = hash(os.hostname());
properties.usernameHash = hash(os.userInfo().username);

Expand Down
1 change: 0 additions & 1 deletion packages/artillery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
"esbuild-wasm": "^0.19.8",
"eventemitter3": "^4.0.4",
"fs-extra": "^10.1.0",
"ip": "^1.1.8",
"is-builtin-module": "^2.0.0",
"joi": "^17.6.0",
"js-yaml": "^3.13.1",
Expand Down
1 change: 0 additions & 1 deletion packages/skytrace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"cli-highlight": "^2.1.11",
"debug": "^4.3.1",
"gradient-string": "^2.0.2",
"ip": "^1.1.8",
"jmespath": "^0.16.0",
"js-yaml": "^3.13.1",
"mime-types": "2.1.35",
Expand Down
1 change: 0 additions & 1 deletion packages/skytrace/src/commands/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const fs = require('fs');
const nodeCrypto = require('node:crypto');

const os = require('os');
const ip = require('ip');

const sprintf = require('sprintf-js').sprintf;
const { Command, flags } = require('@oclif/command');
Expand Down

0 comments on commit 3f45ead

Please sign in to comment.