Skip to content

Commit 438fa0b

Browse files
committed
test: added checks for command existence before running nat tests
1 parent 96a1688 commit 438fa0b

File tree

5 files changed

+249
-228
lines changed

5 files changed

+249
-228
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
"node-gyp-build": "4.4.0",
138138
"pkg": "5.6.0",
139139
"prettier": "^2.6.2",
140+
"shelljs": "^0.8.5",
140141
"shx": "^0.3.4",
141142
"ts-jest": "^27.0.5",
142143
"ts-node": "^10.4.0",

tests/nat/endpointDependentNAT.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import os from 'os';
22
import path from 'path';
33
import fs from 'fs';
44
import process from 'process';
5+
import shell from 'shelljs';
56
import Logger, { LogLevel, StreamHandler } from '@matrixai/logger';
67
import * as testNatUtils from './utils';
78
import { describeIf } from '../utils';
89

910
describeIf(
10-
process.platform === 'linux',
11+
process.platform === 'linux' &&
12+
shell.which('ip') &&
13+
shell.which('iptables') &&
14+
shell.which('nsenter') &&
15+
shell.which('unshare'),
1116
'endpoint dependent NAT traversal',
1217
() => {
1318
const logger = new Logger('EDM NAT test', LogLevel.WARN, [

tests/nat/endpointIndependentNAT.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import os from 'os';
22
import path from 'path';
33
import fs from 'fs';
44
import process from 'process';
5+
import shell from 'shelljs';
56
import Logger, { LogLevel, StreamHandler } from '@matrixai/logger';
67
import * as testNatUtils from './utils';
78
import { describeIf } from '../utils';
89

910
describeIf(
10-
process.platform === 'linux',
11+
process.platform === 'linux' &&
12+
shell.which('ip') &&
13+
shell.which('iptables') &&
14+
shell.which('nsenter') &&
15+
shell.which('unshare'),
1116
'endpoint independent NAT traversal',
1217
() => {
1318
const logger = new Logger('EIM NAT test', LogLevel.WARN, [

0 commit comments

Comments
 (0)