@gatling.io/cli 3.11.7 → 3.13.1
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/package.json +8 -6
- package/polyfills/crypto.js +87 -0
- package/polyfills/global.js +13 -0
- package/src/bundle/index.ts +43 -0
- package/src/bundle/polyfill.ts +91 -0
- package/src/commands/build.ts +34 -0
- package/src/commands/enterpriseDeploy.ts +97 -0
- package/src/commands/enterprisePackage.ts +45 -0
- package/src/commands/enterpriseStart.ts +122 -0
- package/src/commands/index.ts +25 -0
- package/src/commands/install.ts +19 -0
- package/src/commands/options.ts +308 -0
- package/src/commands/recorder.ts +41 -0
- package/src/commands/run.ts +82 -0
- package/src/commands/runOnly.ts +56 -0
- package/src/dependencies/coursier.ts +84 -0
- package/src/dependencies/download.ts +11 -0
- package/src/dependencies/graalVm.ts +74 -0
- package/src/dependencies/index.ts +45 -0
- package/src/dependencies/os.ts +24 -0
- package/src/dependencies/versions.ts +15 -0
- package/src/enterprise.ts +227 -0
- package/src/index.ts +5 -0
- package/src/java.ts +48 -0
- package/src/log.ts +19 -0
- package/src/readline.ts +39 -0
- package/src/run.ts +67 -0
- package/src/simulations.ts +29 -0
- package/target/{bundle.d.ts → bundle/index.d.ts} +2 -1
- package/target/{bundle.js → bundle/index.js} +7 -1
- package/target/bundle/polyfill.d.ts +2 -0
- package/target/bundle/polyfill.js +83 -0
- package/target/commands/build.d.ts +3 -0
- package/target/commands/build.js +22 -0
- package/target/commands/enterpriseDeploy.d.ts +3 -0
- package/target/commands/enterpriseDeploy.js +64 -0
- package/target/commands/enterprisePackage.d.ts +3 -0
- package/target/commands/enterprisePackage.js +28 -0
- package/target/commands/enterpriseStart.d.ts +3 -0
- package/target/commands/enterpriseStart.js +80 -0
- package/target/commands/index.d.ts +2 -0
- package/target/commands/index.js +28 -0
- package/target/commands/install.d.ts +3 -0
- package/target/commands/install.js +18 -0
- package/target/commands/options.d.ts +50 -0
- package/target/commands/options.js +214 -0
- package/target/commands/recorder.d.ts +3 -0
- package/target/commands/recorder.js +28 -0
- package/target/commands/run.d.ts +3 -0
- package/target/commands/run.js +53 -0
- package/target/commands/runOnly.d.ts +3 -0
- package/target/commands/runOnly.js +37 -0
- package/target/dependencies/coursier.d.ts +1 -1
- package/target/dependencies/coursier.js +11 -6
- package/target/dependencies/index.d.ts +2 -0
- package/target/dependencies/index.js +4 -2
- package/target/dependencies/versions.d.ts +3 -0
- package/target/dependencies/versions.js +9 -6
- package/target/enterprise.d.ts +2 -1
- package/target/enterprise.js +7 -6
- package/target/index.js +2 -337
- package/target/run.js +4 -2
- package/tsconfig.json +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gatling.io/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gatling": "target/index.js"
|
|
@@ -8,22 +8,24 @@
|
|
|
8
8
|
"main": "target/index.js",
|
|
9
9
|
"types": "target/index.d.ts",
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@jspm/core": "2.1.0",
|
|
11
12
|
"archiver": "7.0.1",
|
|
12
|
-
"axios": "1.7.
|
|
13
|
+
"axios": "1.7.7",
|
|
13
14
|
"commander": "12.1.0",
|
|
14
15
|
"decompress": "4.2.1",
|
|
15
|
-
"esbuild": "0.
|
|
16
|
+
"esbuild": "0.24.0",
|
|
16
17
|
"esbuild-plugin-tsc": "0.4.0",
|
|
18
|
+
"import-meta-resolve": "4.1.0",
|
|
17
19
|
"readline-sync": "1.4.10"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
|
-
"@types/archiver": "6.0.
|
|
22
|
+
"@types/archiver": "6.0.3",
|
|
21
23
|
"@types/decompress": "4.2.7",
|
|
22
|
-
"@types/node": "
|
|
24
|
+
"@types/node": "18.19.64",
|
|
23
25
|
"@types/readline-sync": "1.4.8",
|
|
24
26
|
"prettier": "3.3.3",
|
|
25
27
|
"rimraf": "6.0.1",
|
|
26
|
-
"typescript": "5.
|
|
28
|
+
"typescript": "5.6.3"
|
|
27
29
|
},
|
|
28
30
|
"scripts": {
|
|
29
31
|
"clean": "rimraf target",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Buffer } from "buffer"
|
|
2
|
+
|
|
3
|
+
// limit of Crypto.getRandomValues()
|
|
4
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
|
|
5
|
+
const MAX_BYTES = 65536;
|
|
6
|
+
|
|
7
|
+
// Node supports requesting up to this number of bytes
|
|
8
|
+
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
|
|
9
|
+
const MAX_UINT32 = 4294967295;
|
|
10
|
+
|
|
11
|
+
const JavaCrypto = Java.type("io.gatling.js.polyfills.Crypto");
|
|
12
|
+
|
|
13
|
+
export const randomBytes = (size, cb) => {
|
|
14
|
+
// Node supports requesting up to this number of bytes
|
|
15
|
+
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
|
|
16
|
+
if (size > MAX_UINT32) {
|
|
17
|
+
throw new RangeError('requested too many random bytes');
|
|
18
|
+
}
|
|
19
|
+
const bytes = Buffer.from(JavaCrypto.randomBytes(size));
|
|
20
|
+
if (typeof cb === 'function') {
|
|
21
|
+
return process.nextTick(function () {
|
|
22
|
+
cb(null, bytes);
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return bytes;
|
|
26
|
+
};
|
|
27
|
+
export const rng = randomBytes;
|
|
28
|
+
export const pseudoRandomBytes = randomBytes;
|
|
29
|
+
export const prng = randomBytes;
|
|
30
|
+
export const getRandomValues = (values) => {
|
|
31
|
+
const byteView = new Uint8Array(values.buffer, values.byteOffset, values.byteLength);
|
|
32
|
+
const bytes = randomBytes(byteView.length);
|
|
33
|
+
for (let i = 0; i < byteView.length; i++) {
|
|
34
|
+
// The range of Math.random() is [0, 1) and the ToUint8 abstract operation rounds down
|
|
35
|
+
byteView[i] = bytes[i];
|
|
36
|
+
}
|
|
37
|
+
return values;
|
|
38
|
+
};
|
|
39
|
+
export const randomUUID = () => JavaCrypto.randomUUID();
|
|
40
|
+
|
|
41
|
+
// export const Cipher = crypto.Cipher;
|
|
42
|
+
// export const Cipheriv = crypto.Cipheriv;
|
|
43
|
+
// export const Decipher = crypto.Decipher;
|
|
44
|
+
// export const Decipheriv = crypto.Decipheriv;
|
|
45
|
+
// export const DiffieHellman = crypto.DiffieHellman;
|
|
46
|
+
// export const DiffieHellmanGroup = crypto.DiffieHellmanGroup;
|
|
47
|
+
// export const Hash = crypto.Hash;
|
|
48
|
+
// export const Hmac = crypto.Hmac;
|
|
49
|
+
// export const Sign = crypto.Sign;
|
|
50
|
+
// export const Verify = crypto.Verify;
|
|
51
|
+
// export const constants = crypto.constants;
|
|
52
|
+
// export const createCipher = crypto.createCipher;
|
|
53
|
+
// export const createCipheriv = crypto.createCipheriv;
|
|
54
|
+
// export const createCredentials = crypto.createCredentials;
|
|
55
|
+
// export const createDecipher = crypto.createDecipher;
|
|
56
|
+
// export const createDecipheriv = crypto.createDecipheriv;
|
|
57
|
+
// export const createDiffieHellman = crypto.createDiffieHellman;
|
|
58
|
+
// export const createDiffieHellmanGroup = crypto.createDiffieHellmanGroup;
|
|
59
|
+
// export const createECDH = crypto.createECDH;
|
|
60
|
+
// export const createHash = crypto.createHash;
|
|
61
|
+
// export const createHmac = crypto.createHmac;
|
|
62
|
+
// export const createSign = crypto.createSign;
|
|
63
|
+
// export const createVerify = crypto.createVerify;
|
|
64
|
+
// export const getCiphers = crypto.getCiphers;
|
|
65
|
+
// export const getDiffieHellman = crypto.getDiffieHellman;
|
|
66
|
+
// export const getHashes = crypto.getHashes;
|
|
67
|
+
// export const listCiphers = crypto.listCiphers;
|
|
68
|
+
// export const pbkdf2 = crypto.pbkdf2;
|
|
69
|
+
// export const pbkdf2Sync = crypto.pbkdf2Sync;
|
|
70
|
+
// export const privateDecrypt = crypto.privateDecrypt;
|
|
71
|
+
// export const privateEncrypt = crypto.privateEncrypt;
|
|
72
|
+
// export const publicDecrypt = crypto.publicDecrypt;
|
|
73
|
+
// export const publicEncrypt = crypto.publicEncrypt;
|
|
74
|
+
// export const randomFill = crypto.randomFill;
|
|
75
|
+
// export const randomFillSync = crypto.randomFillSync;
|
|
76
|
+
|
|
77
|
+
const crypto = {
|
|
78
|
+
randomBytes,
|
|
79
|
+
rng,
|
|
80
|
+
pseudoRandomBytes,
|
|
81
|
+
prng,
|
|
82
|
+
getRandomValues,
|
|
83
|
+
randomUUID,
|
|
84
|
+
};
|
|
85
|
+
crypto.webcrypto = crypto;
|
|
86
|
+
globalThis.crypto = crypto;
|
|
87
|
+
export default crypto;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const global = globalThis;
|
|
2
|
+
export { global };
|
|
3
|
+
|
|
4
|
+
export { Buffer } from "buffer";
|
|
5
|
+
|
|
6
|
+
// These values are used by some of the JSPM polyfills
|
|
7
|
+
export const navigator = {
|
|
8
|
+
deviceMemory: 8, // Highest allowed value
|
|
9
|
+
hardwareConcurrency: 8, // Fairly common default
|
|
10
|
+
language: "en-US", // Most common default
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export * as crypto from "crypto"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as esbuild from "esbuild";
|
|
2
|
+
import esbuildPluginTsc from "esbuild-plugin-tsc";
|
|
3
|
+
|
|
4
|
+
import { polyfill } from "./polyfill";
|
|
5
|
+
import { SimulationFile } from "../simulations";
|
|
6
|
+
import { logger } from "../log";
|
|
7
|
+
|
|
8
|
+
export interface BundleOptions {
|
|
9
|
+
sourcesFolder: string;
|
|
10
|
+
bundleFile: string;
|
|
11
|
+
postman?: string;
|
|
12
|
+
typescript: boolean;
|
|
13
|
+
simulations: SimulationFile[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const bundle = async (options: BundleOptions): Promise<void> => {
|
|
17
|
+
logger.info(`Bundling a Gatling simulation with options:
|
|
18
|
+
- sourcesFolder: ${options.sourcesFolder}
|
|
19
|
+
- bundleFile: ${options.bundleFile}
|
|
20
|
+
- typescript: ${options.typescript}`);
|
|
21
|
+
|
|
22
|
+
const contents = options.simulations.map((s) => `export { default as "${s.name}" } from "./${s.path}";`).join("\n");
|
|
23
|
+
|
|
24
|
+
const plugins = options.typescript ? [esbuildPluginTsc({ force: true })] : [];
|
|
25
|
+
if (options.postman !== undefined) {
|
|
26
|
+
plugins.push(polyfill());
|
|
27
|
+
}
|
|
28
|
+
await esbuild.build({
|
|
29
|
+
stdin: {
|
|
30
|
+
contents,
|
|
31
|
+
resolveDir: options.sourcesFolder
|
|
32
|
+
},
|
|
33
|
+
outfile: options.bundleFile,
|
|
34
|
+
platform: "neutral",
|
|
35
|
+
mainFields: ["main", "module"],
|
|
36
|
+
bundle: true,
|
|
37
|
+
minify: false,
|
|
38
|
+
sourcemap: true,
|
|
39
|
+
format: "iife",
|
|
40
|
+
globalName: "gatling",
|
|
41
|
+
plugins
|
|
42
|
+
});
|
|
43
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
3
|
+
import { resolve, dirname } from "path";
|
|
4
|
+
|
|
5
|
+
// This is largely inspired by https://github.com/cyco130/esbuild-plugin-polyfill-node
|
|
6
|
+
|
|
7
|
+
export const polyfill = (): Plugin => ({
|
|
8
|
+
name: "gatling-js-polyfill",
|
|
9
|
+
setup: async (build) => {
|
|
10
|
+
// modules
|
|
11
|
+
const jspmResolved = await resolveImport(`@jspm/core/nodelibs/fs`);
|
|
12
|
+
build.onResolve({ filter: polyfillsFilter }, async ({ path }) => {
|
|
13
|
+
const [, , moduleName] = path.match(polyfillsFilter)!;
|
|
14
|
+
const resolved = customPolyfills.find((name) => name === moduleName)
|
|
15
|
+
? resolve(dirname(__filename), `../../polyfills/${moduleName}.js`)
|
|
16
|
+
: resolve(jspmResolved, `../../browser/${moduleName}.js`);
|
|
17
|
+
return { path: resolved };
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Globals
|
|
21
|
+
build.initialOptions.inject = build.initialOptions.inject || [];
|
|
22
|
+
const injectGlobal = (name: string) =>
|
|
23
|
+
(build.initialOptions.inject as string[]).push(resolve(dirname(__filename), `../../polyfills/${name}.js`));
|
|
24
|
+
injectGlobal("global");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const customPolyfills = ["crypto"];
|
|
29
|
+
|
|
30
|
+
const jspmPolyfills = ["buffer", "path", "string_decoder"];
|
|
31
|
+
|
|
32
|
+
// Other available jspm-core modules:
|
|
33
|
+
// "_stream_duplex"
|
|
34
|
+
// "_stream_passthrough"
|
|
35
|
+
// "_stream_readable"
|
|
36
|
+
// "_stream_transform"
|
|
37
|
+
// "_stream_writable"
|
|
38
|
+
// "assert"
|
|
39
|
+
// "assert/strict"
|
|
40
|
+
// "async_hooks"
|
|
41
|
+
// "child_process"
|
|
42
|
+
// "cluster"
|
|
43
|
+
// "console"
|
|
44
|
+
// "constants"
|
|
45
|
+
// "crypto"
|
|
46
|
+
// "dgram"
|
|
47
|
+
// "diagnostics_channel"
|
|
48
|
+
// "dns"
|
|
49
|
+
// "domain"
|
|
50
|
+
// "events"
|
|
51
|
+
// "fs"
|
|
52
|
+
// "fs/promises"
|
|
53
|
+
// "http"
|
|
54
|
+
// "http2"
|
|
55
|
+
// "https"
|
|
56
|
+
// "module"
|
|
57
|
+
// "net"
|
|
58
|
+
// "os"
|
|
59
|
+
// "perf_hooks"
|
|
60
|
+
// "process"
|
|
61
|
+
// "punycode"
|
|
62
|
+
// "querystring"
|
|
63
|
+
// "readline"
|
|
64
|
+
// "repl"
|
|
65
|
+
// "stream"
|
|
66
|
+
// "sys"
|
|
67
|
+
// "timers"
|
|
68
|
+
// "timers/promises"
|
|
69
|
+
// "tls"
|
|
70
|
+
// "tty"
|
|
71
|
+
// "url"
|
|
72
|
+
// "util"
|
|
73
|
+
// "v8"
|
|
74
|
+
// "vm"
|
|
75
|
+
// "wasi"
|
|
76
|
+
// "worker_threads"
|
|
77
|
+
// "zlib"
|
|
78
|
+
|
|
79
|
+
const polyfillsFilter = new RegExp(`^(node:)?(${jspmPolyfills.concat(customPolyfills).join("|")})$`);
|
|
80
|
+
|
|
81
|
+
let importMetaResolve: (specifier: string, parent: string) => string;
|
|
82
|
+
|
|
83
|
+
const importMetaUrl = pathToFileURL(__filename).href;
|
|
84
|
+
|
|
85
|
+
const resolveImport = async (specifier: string) => {
|
|
86
|
+
if (!importMetaResolve) {
|
|
87
|
+
importMetaResolve = (await import("import-meta-resolve")).resolve;
|
|
88
|
+
}
|
|
89
|
+
const resolved = importMetaResolve(specifier, importMetaUrl);
|
|
90
|
+
return fileURLToPath(resolved);
|
|
91
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
bundleFileOption,
|
|
5
|
+
bundleFileOptionValue,
|
|
6
|
+
postmanOption,
|
|
7
|
+
postmanOptionValueWithDefaults,
|
|
8
|
+
sourcesFolderOption,
|
|
9
|
+
sourcesFolderOptionValue,
|
|
10
|
+
typescriptOption,
|
|
11
|
+
typescriptOptionValueWithDefaults
|
|
12
|
+
} from "./options";
|
|
13
|
+
import { findSimulations } from "../simulations";
|
|
14
|
+
import { bundle } from "../bundle";
|
|
15
|
+
|
|
16
|
+
export default (program: Command): void => {
|
|
17
|
+
program
|
|
18
|
+
.command("build")
|
|
19
|
+
.description("Build Gatling simulations")
|
|
20
|
+
.addOption(sourcesFolderOption)
|
|
21
|
+
.addOption(bundleFileOption)
|
|
22
|
+
.addOption(postmanOption)
|
|
23
|
+
.addOption(typescriptOption)
|
|
24
|
+
.action(async (options) => {
|
|
25
|
+
const sourcesFolder: string = sourcesFolderOptionValue(options);
|
|
26
|
+
const bundleFile = bundleFileOptionValue(options);
|
|
27
|
+
|
|
28
|
+
const simulations = await findSimulations(sourcesFolder);
|
|
29
|
+
const postman = postmanOptionValueWithDefaults(options);
|
|
30
|
+
const typescript = typescriptOptionValueWithDefaults(options, simulations);
|
|
31
|
+
|
|
32
|
+
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
apiTokenOption,
|
|
5
|
+
apiTokenOptionValue,
|
|
6
|
+
bundleFileOption,
|
|
7
|
+
bundleFileOptionValue,
|
|
8
|
+
controlPlaneUrlOption,
|
|
9
|
+
controlPlaneUrlOptionValue,
|
|
10
|
+
gatlingHomeOption,
|
|
11
|
+
gatlingHomeOptionValueWithDefaults,
|
|
12
|
+
nonInteractiveOption,
|
|
13
|
+
nonInteractiveOptionValue,
|
|
14
|
+
packageDescriptorFilenameOption,
|
|
15
|
+
packageDescriptorFilenameOptionValue,
|
|
16
|
+
packageFileOption,
|
|
17
|
+
packageFileOptionValue,
|
|
18
|
+
postmanOption,
|
|
19
|
+
postmanOptionValueWithDefaults,
|
|
20
|
+
resourcesFolderOption,
|
|
21
|
+
resourcesFolderOptionValue,
|
|
22
|
+
resultsFolderOption,
|
|
23
|
+
resultsFolderOptionValue,
|
|
24
|
+
sourcesFolderOption,
|
|
25
|
+
sourcesFolderOptionValue,
|
|
26
|
+
typescriptOption,
|
|
27
|
+
typescriptOptionValueWithDefaults,
|
|
28
|
+
apiUrlOption,
|
|
29
|
+
apiUrlOptionValue,
|
|
30
|
+
webAppUrlOption,
|
|
31
|
+
webAppUrlOptionValue
|
|
32
|
+
} from "./options";
|
|
33
|
+
import { findSimulations } from "../simulations";
|
|
34
|
+
import { installGatlingJs } from "../dependencies";
|
|
35
|
+
import { bundle } from "../bundle";
|
|
36
|
+
import { enterpriseDeploy, enterprisePackage } from "../enterprise";
|
|
37
|
+
|
|
38
|
+
export default (program: Command): void => {
|
|
39
|
+
program
|
|
40
|
+
.command("enterprise-deploy")
|
|
41
|
+
.description("Deploy a package and configured simulations")
|
|
42
|
+
.addOption(sourcesFolderOption)
|
|
43
|
+
.addOption(resourcesFolderOption)
|
|
44
|
+
.addOption(bundleFileOption)
|
|
45
|
+
.addOption(resultsFolderOption)
|
|
46
|
+
.addOption(postmanOption)
|
|
47
|
+
.addOption(typescriptOption)
|
|
48
|
+
.addOption(gatlingHomeOption)
|
|
49
|
+
// Base
|
|
50
|
+
.addOption(apiUrlOption)
|
|
51
|
+
.addOption(webAppUrlOption)
|
|
52
|
+
.addOption(apiTokenOption)
|
|
53
|
+
// Plugin configuration
|
|
54
|
+
.addOption(controlPlaneUrlOption)
|
|
55
|
+
.addOption(nonInteractiveOption)
|
|
56
|
+
// Descriptor file
|
|
57
|
+
.addOption(packageDescriptorFilenameOption)
|
|
58
|
+
// Deployment info
|
|
59
|
+
.addOption(packageFileOption)
|
|
60
|
+
.action(async (options) => {
|
|
61
|
+
const sourcesFolder: string = sourcesFolderOptionValue(options);
|
|
62
|
+
|
|
63
|
+
const simulations = await findSimulations(sourcesFolder);
|
|
64
|
+
const postman = postmanOptionValueWithDefaults(options);
|
|
65
|
+
const typescript = typescriptOptionValueWithDefaults(options, simulations);
|
|
66
|
+
|
|
67
|
+
const resourcesFolder: string = resourcesFolderOptionValue(options);
|
|
68
|
+
const bundleFile = bundleFileOptionValue(options);
|
|
69
|
+
const resultsFolder: string = resultsFolderOptionValue(options);
|
|
70
|
+
const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
|
|
71
|
+
const apiUrl = apiUrlOptionValue(options);
|
|
72
|
+
const webAppUrl = webAppUrlOptionValue(options);
|
|
73
|
+
const apiToken = apiTokenOptionValue(options);
|
|
74
|
+
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
|
|
75
|
+
const nonInteractive = nonInteractiveOptionValue(options);
|
|
76
|
+
const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
|
|
77
|
+
const packageFile = packageFileOptionValue(options);
|
|
78
|
+
|
|
79
|
+
const { graalvmHome, jvmClasspath } = await installGatlingJs({ gatlingHome });
|
|
80
|
+
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
|
|
81
|
+
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
82
|
+
await enterpriseDeploy({
|
|
83
|
+
graalvmHome,
|
|
84
|
+
jvmClasspath,
|
|
85
|
+
bundleFile,
|
|
86
|
+
resourcesFolder,
|
|
87
|
+
resultsFolder,
|
|
88
|
+
apiUrl,
|
|
89
|
+
webAppUrl,
|
|
90
|
+
apiToken,
|
|
91
|
+
controlPlaneUrl,
|
|
92
|
+
nonInteractive,
|
|
93
|
+
packageDescriptorFilename,
|
|
94
|
+
packageFile
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
bundleFileOption,
|
|
5
|
+
bundleFileOptionValue,
|
|
6
|
+
packageFileOption,
|
|
7
|
+
packageFileOptionValue,
|
|
8
|
+
postmanOption,
|
|
9
|
+
postmanOptionValueWithDefaults,
|
|
10
|
+
resourcesFolderOption,
|
|
11
|
+
resourcesFolderOptionValue,
|
|
12
|
+
sourcesFolderOption,
|
|
13
|
+
sourcesFolderOptionValue,
|
|
14
|
+
typescriptOption,
|
|
15
|
+
typescriptOptionValueWithDefaults
|
|
16
|
+
} from "./options";
|
|
17
|
+
import { findSimulations } from "../simulations";
|
|
18
|
+
import { bundle } from "../bundle";
|
|
19
|
+
import { enterprisePackage } from "../enterprise";
|
|
20
|
+
|
|
21
|
+
export default (program: Command): void => {
|
|
22
|
+
program
|
|
23
|
+
.command("enterprise-package")
|
|
24
|
+
.description("Build Gatling simulations and package them for Gatling Enterprise")
|
|
25
|
+
.addOption(sourcesFolderOption)
|
|
26
|
+
.addOption(resourcesFolderOption)
|
|
27
|
+
.addOption(bundleFileOption)
|
|
28
|
+
.addOption(packageFileOption)
|
|
29
|
+
.addOption(postmanOption)
|
|
30
|
+
.addOption(typescriptOption)
|
|
31
|
+
.action(async (options) => {
|
|
32
|
+
const sourcesFolder: string = sourcesFolderOptionValue(options);
|
|
33
|
+
const resourcesFolder: string = resourcesFolderOptionValue(options);
|
|
34
|
+
const bundleFile = bundleFileOptionValue(options);
|
|
35
|
+
const packageFile = packageFileOptionValue(options);
|
|
36
|
+
|
|
37
|
+
const simulations = await findSimulations(sourcesFolder);
|
|
38
|
+
const postman = postmanOptionValueWithDefaults(options);
|
|
39
|
+
const typescript = typescriptOptionValueWithDefaults(options, simulations);
|
|
40
|
+
|
|
41
|
+
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
|
|
42
|
+
|
|
43
|
+
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
apiTokenOption,
|
|
5
|
+
apiTokenOptionValue,
|
|
6
|
+
bundleFileOption,
|
|
7
|
+
bundleFileOptionValue,
|
|
8
|
+
controlPlaneUrlOption,
|
|
9
|
+
controlPlaneUrlOptionValue,
|
|
10
|
+
enterpriseSimulationOption,
|
|
11
|
+
enterpriseSimulationOptionValue,
|
|
12
|
+
gatlingHomeOption,
|
|
13
|
+
gatlingHomeOptionValueWithDefaults,
|
|
14
|
+
nonInteractiveOption,
|
|
15
|
+
nonInteractiveOptionValue,
|
|
16
|
+
packageDescriptorFilenameOption,
|
|
17
|
+
packageDescriptorFilenameOptionValue,
|
|
18
|
+
packageFileOption,
|
|
19
|
+
packageFileOptionValue,
|
|
20
|
+
postmanOption,
|
|
21
|
+
postmanOptionValueWithDefaults,
|
|
22
|
+
resourcesFolderOption,
|
|
23
|
+
resourcesFolderOptionValue,
|
|
24
|
+
resultsFolderOption,
|
|
25
|
+
resultsFolderOptionValue,
|
|
26
|
+
runDescriptionOption,
|
|
27
|
+
runDescriptionOptionValue,
|
|
28
|
+
runTitleOption,
|
|
29
|
+
runTitleOptionValue,
|
|
30
|
+
sourcesFolderOption,
|
|
31
|
+
sourcesFolderOptionValue,
|
|
32
|
+
typescriptOption,
|
|
33
|
+
typescriptOptionValueWithDefaults,
|
|
34
|
+
apiUrlOption,
|
|
35
|
+
apiUrlOptionValue,
|
|
36
|
+
webAppUrlOption,
|
|
37
|
+
webAppUrlOptionValue,
|
|
38
|
+
waitForRunEndOption,
|
|
39
|
+
waitForRunEndOptionValue
|
|
40
|
+
} from "./options";
|
|
41
|
+
import { findSimulations } from "../simulations";
|
|
42
|
+
import { installGatlingJs } from "../dependencies";
|
|
43
|
+
import { bundle } from "../bundle";
|
|
44
|
+
import { enterprisePackage, enterpriseStart } from "../enterprise";
|
|
45
|
+
|
|
46
|
+
export default (program: Command): void => {
|
|
47
|
+
program
|
|
48
|
+
.command("enterprise-start")
|
|
49
|
+
.description("Start a simulation deployed with `enterprise-deploy`")
|
|
50
|
+
.addOption(sourcesFolderOption)
|
|
51
|
+
.addOption(resourcesFolderOption)
|
|
52
|
+
.addOption(bundleFileOption)
|
|
53
|
+
.addOption(resultsFolderOption)
|
|
54
|
+
.addOption(postmanOption)
|
|
55
|
+
.addOption(typescriptOption)
|
|
56
|
+
.addOption(gatlingHomeOption)
|
|
57
|
+
// Base
|
|
58
|
+
.addOption(apiUrlOption)
|
|
59
|
+
.addOption(webAppUrlOption)
|
|
60
|
+
.addOption(apiTokenOption)
|
|
61
|
+
// Plugin configuration
|
|
62
|
+
.addOption(controlPlaneUrlOption)
|
|
63
|
+
.addOption(nonInteractiveOption)
|
|
64
|
+
// Descriptor file
|
|
65
|
+
.addOption(packageDescriptorFilenameOption)
|
|
66
|
+
// Deployment info
|
|
67
|
+
.addOption(packageFileOption)
|
|
68
|
+
// Start
|
|
69
|
+
.addOption(enterpriseSimulationOption)
|
|
70
|
+
.addOption(runTitleOption)
|
|
71
|
+
.addOption(runDescriptionOption)
|
|
72
|
+
.addOption(waitForRunEndOption)
|
|
73
|
+
.action(async (options) => {
|
|
74
|
+
const sourcesFolder: string = sourcesFolderOptionValue(options);
|
|
75
|
+
|
|
76
|
+
const simulations = await findSimulations(sourcesFolder);
|
|
77
|
+
const postman = postmanOptionValueWithDefaults(options);
|
|
78
|
+
const typescript = typescriptOptionValueWithDefaults(options, simulations);
|
|
79
|
+
|
|
80
|
+
const resourcesFolder: string = resourcesFolderOptionValue(options);
|
|
81
|
+
const bundleFile = bundleFileOptionValue(options);
|
|
82
|
+
const resultsFolder: string = resultsFolderOptionValue(options);
|
|
83
|
+
const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
|
|
84
|
+
const apiUrl = apiUrlOptionValue(options);
|
|
85
|
+
const webAppUrl = webAppUrlOptionValue(options);
|
|
86
|
+
const apiToken = apiTokenOptionValue(options);
|
|
87
|
+
const controlPlaneUrl = controlPlaneUrlOptionValue(options);
|
|
88
|
+
const nonInteractive = nonInteractiveOptionValue(options);
|
|
89
|
+
const packageDescriptorFilename = packageDescriptorFilenameOptionValue(options);
|
|
90
|
+
const packageFile = packageFileOptionValue(options);
|
|
91
|
+
const enterpriseSimulation = enterpriseSimulationOptionValue(options);
|
|
92
|
+
const runTitle = runTitleOptionValue(options);
|
|
93
|
+
const runDescription = runDescriptionOptionValue(options);
|
|
94
|
+
const waitForRunEnd = waitForRunEndOptionValue(options);
|
|
95
|
+
|
|
96
|
+
if (nonInteractiveOptionValue(options) && enterpriseSimulation === undefined) {
|
|
97
|
+
throw new Error(`No simulation specified when using non-interactive mode`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const { graalvmHome, jvmClasspath } = await installGatlingJs({ gatlingHome });
|
|
101
|
+
await bundle({ sourcesFolder, bundleFile, postman, typescript, simulations });
|
|
102
|
+
await enterprisePackage({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
103
|
+
await enterpriseStart({
|
|
104
|
+
graalvmHome,
|
|
105
|
+
jvmClasspath,
|
|
106
|
+
bundleFile,
|
|
107
|
+
resourcesFolder,
|
|
108
|
+
resultsFolder,
|
|
109
|
+
apiUrl,
|
|
110
|
+
webAppUrl,
|
|
111
|
+
apiToken,
|
|
112
|
+
controlPlaneUrl,
|
|
113
|
+
nonInteractive,
|
|
114
|
+
packageDescriptorFilename,
|
|
115
|
+
packageFile,
|
|
116
|
+
enterpriseSimulation,
|
|
117
|
+
runTitle,
|
|
118
|
+
runDescription,
|
|
119
|
+
waitForRunEnd
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import registerInstallCommand from "./install";
|
|
4
|
+
import registerBuildCommand from "./build";
|
|
5
|
+
import registerRunOnlyCommand from "./runOnly";
|
|
6
|
+
import registerRunCommand from "./run";
|
|
7
|
+
import registerRecorderCommand from "./recorder";
|
|
8
|
+
import registerEnterprisePackageCommand from "./enterprisePackage";
|
|
9
|
+
import registerEnterpriseDeployCommand from "./enterpriseDeploy";
|
|
10
|
+
import registerEnterpriseStartCommand from "./enterpriseStart";
|
|
11
|
+
import { versions } from "../dependencies";
|
|
12
|
+
|
|
13
|
+
export const program: Command = new Command()
|
|
14
|
+
.name("gatling-js-cli")
|
|
15
|
+
.version(versions.gatling.jsAdapter)
|
|
16
|
+
.description("The Gatling Javascript run & packaging tool");
|
|
17
|
+
|
|
18
|
+
registerInstallCommand(program);
|
|
19
|
+
registerBuildCommand(program);
|
|
20
|
+
registerRunOnlyCommand(program);
|
|
21
|
+
registerRunCommand(program);
|
|
22
|
+
registerRecorderCommand(program);
|
|
23
|
+
registerEnterprisePackageCommand(program);
|
|
24
|
+
registerEnterpriseDeployCommand(program);
|
|
25
|
+
registerEnterpriseStartCommand(program);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
import { gatlingHomeOption, gatlingHomeOptionValueWithDefaults } from "./options";
|
|
4
|
+
import { installGatlingJs } from "../dependencies";
|
|
5
|
+
import { logger } from "../log";
|
|
6
|
+
|
|
7
|
+
export default (program: Command): void => {
|
|
8
|
+
program
|
|
9
|
+
.command("install")
|
|
10
|
+
.description("Install all required components and dependencies for Gatling")
|
|
11
|
+
.addOption(gatlingHomeOption)
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
const gatlingHome = gatlingHomeOptionValueWithDefaults(options);
|
|
14
|
+
const { graalvmHome, coursierBinary, jvmClasspath } = await installGatlingJs({ gatlingHome });
|
|
15
|
+
logger.info(`graalvmHome=${graalvmHome}`);
|
|
16
|
+
logger.info(`coursierBinary=${coursierBinary}`);
|
|
17
|
+
logger.info(`jvmClasspath=${jvmClasspath}`);
|
|
18
|
+
});
|
|
19
|
+
};
|