@gatling.io/cli 3.11.7 → 3.12.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.
- package/package.json +4 -4
- package/src/bundle.ts +36 -0
- package/src/commands/build.ts +30 -0
- package/src/commands/enterpriseDeploy.ts +88 -0
- package/src/commands/enterprisePackage.ts +41 -0
- package/src/commands/enterpriseStart.ts +113 -0
- package/src/commands/index.ts +25 -0
- package/src/commands/install.ts +19 -0
- package/src/commands/options.ts +263 -0
- package/src/commands/recorder.ts +41 -0
- package/src/commands/run.ts +78 -0
- package/src/commands/runOnly.ts +56 -0
- package/src/dependencies/coursier.ts +82 -0
- package/src/dependencies/download.ts +11 -0
- package/src/dependencies/graalVm.ts +74 -0
- package/src/dependencies/index.ts +44 -0
- package/src/dependencies/os.ts +24 -0
- package/src/dependencies/versions.ts +12 -0
- package/src/enterprise.ts +225 -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/commands/build.d.ts +3 -0
- package/target/commands/build.js +20 -0
- package/target/commands/enterpriseDeploy.d.ts +3 -0
- package/target/commands/enterpriseDeploy.js +59 -0
- package/target/commands/enterprisePackage.d.ts +3 -0
- package/target/commands/enterprisePackage.js +26 -0
- package/target/commands/enterpriseStart.d.ts +3 -0
- package/target/commands/enterpriseStart.js +75 -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 +46 -0
- package/target/commands/options.js +169 -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 +51 -0
- package/target/commands/runOnly.d.ts +3 -0
- package/target/commands/runOnly.js +37 -0
- package/target/dependencies/index.d.ts +1 -0
- package/target/dependencies/index.js +3 -1
- package/target/dependencies/versions.js +2 -2
- package/target/enterprise.js +5 -5
- package/target/index.js +2 -337
- package/target/run.js +4 -2
- package/tsconfig.json +18 -0
package/src/java.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
|
|
3
|
+
import { osType } from "./dependencies/os";
|
|
4
|
+
import { logger } from "./log";
|
|
5
|
+
|
|
6
|
+
export interface RunJavaProcessOptions {
|
|
7
|
+
graalvmHome: string;
|
|
8
|
+
jvmClasspath: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const runJavaProcess = (
|
|
12
|
+
options: RunJavaProcessOptions,
|
|
13
|
+
mainClass: string,
|
|
14
|
+
additionalClasspathElements: string[],
|
|
15
|
+
javaArgs: string[],
|
|
16
|
+
mainClassArgs: string[]
|
|
17
|
+
): Promise<void> => {
|
|
18
|
+
const command = `${options.graalvmHome}/bin/java`;
|
|
19
|
+
const classpathSeparator = osType === "Windows_NT" ? ";" : ":";
|
|
20
|
+
const classpath = [...additionalClasspathElements, options.jvmClasspath].join(classpathSeparator);
|
|
21
|
+
const allArgs = [
|
|
22
|
+
"-server",
|
|
23
|
+
"-XX:+HeapDumpOnOutOfMemoryError",
|
|
24
|
+
"-XX:MaxInlineLevel=20",
|
|
25
|
+
"-XX:MaxTrivialSize=12",
|
|
26
|
+
"-classpath",
|
|
27
|
+
classpath,
|
|
28
|
+
...javaArgs,
|
|
29
|
+
mainClass,
|
|
30
|
+
...mainClassArgs
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const spawned = spawn(command, allArgs, {
|
|
34
|
+
env: process.env,
|
|
35
|
+
stdio: [process.stdin, process.stdout, process.stderr]
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
spawned.on("error", (error) => logger.error("Failed to run Gatling process: " + error.toString()));
|
|
40
|
+
spawned.on("close", (code) => {
|
|
41
|
+
if (code === 0) {
|
|
42
|
+
resolve();
|
|
43
|
+
} else {
|
|
44
|
+
reject(Error("Gatling process finished with code " + code));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
package/src/log.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const debug: (message: string) => void =
|
|
2
|
+
// On Node.js, console.debug is just an alias to console.log, so we handle debug level ourselves
|
|
3
|
+
process.env["DEBUG"] === "true" ? console.debug : () => {};
|
|
4
|
+
|
|
5
|
+
const info: (message: string) => void = console.info;
|
|
6
|
+
|
|
7
|
+
const error: (message: string) => void = console.error;
|
|
8
|
+
|
|
9
|
+
export interface Logger {
|
|
10
|
+
debug: (message: string) => void;
|
|
11
|
+
info: (message: string) => void;
|
|
12
|
+
error: (message: string) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const logger: Logger = {
|
|
16
|
+
debug,
|
|
17
|
+
info,
|
|
18
|
+
error
|
|
19
|
+
};
|
package/src/readline.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { keyInSelect, BasicOptions } from "readline-sync";
|
|
2
|
+
|
|
3
|
+
// Inspired by https://github.com/anseki/readline-sync/issues/60#issuecomment-324533678
|
|
4
|
+
// Pagination avoids very long lists to scroll though, as well as the hard limit at 35 items for keyInSelect
|
|
5
|
+
export const keyInSelectPaginated = (items: string[], query?: any, options?: BasicOptions | undefined): number => {
|
|
6
|
+
if (items.length === 0) {
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const maxItemsPerPage = 10;
|
|
11
|
+
const maxPageIndex = Math.ceil(items.length / maxItemsPerPage) - 1;
|
|
12
|
+
|
|
13
|
+
let pageIndex = 0;
|
|
14
|
+
while (true) {
|
|
15
|
+
const pageItems = [];
|
|
16
|
+
let indexPrev = -1;
|
|
17
|
+
let indexNext = -1;
|
|
18
|
+
if (pageIndex > 0) {
|
|
19
|
+
pageItems.push(`(PREVIOUS ${maxItemsPerPage} items)`);
|
|
20
|
+
indexPrev = pageItems.length - 1;
|
|
21
|
+
}
|
|
22
|
+
pageItems.push(...items.slice(pageIndex * maxItemsPerPage, (pageIndex + 1) * maxItemsPerPage));
|
|
23
|
+
if (pageIndex < maxPageIndex) {
|
|
24
|
+
pageItems.push(
|
|
25
|
+
`(NEXT ${pageIndex < maxPageIndex - 1 ? maxItemsPerPage : items.length - maxItemsPerPage * (pageIndex + 1)} item(s))`
|
|
26
|
+
);
|
|
27
|
+
indexNext = pageItems.length - 1;
|
|
28
|
+
}
|
|
29
|
+
console.log("\x1B[2J"); // clear screen
|
|
30
|
+
const index = keyInSelect(pageItems, query, options);
|
|
31
|
+
if (indexPrev !== -1 && index === indexPrev) {
|
|
32
|
+
pageIndex--;
|
|
33
|
+
} else if (indexNext !== -1 && index === indexNext) {
|
|
34
|
+
pageIndex++;
|
|
35
|
+
} else {
|
|
36
|
+
return index === -1 ? index : index + pageIndex * maxItemsPerPage - (indexPrev === -1 ? 0 : 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
package/src/run.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { logger } from "./log";
|
|
2
|
+
import { versions } from "./dependencies";
|
|
3
|
+
import { RunJavaProcessOptions, runJavaProcess } from "./java";
|
|
4
|
+
|
|
5
|
+
export interface RunSimulationOptions extends RunJavaProcessOptions {
|
|
6
|
+
simulation: string;
|
|
7
|
+
bundleFile: string;
|
|
8
|
+
resourcesFolder: string;
|
|
9
|
+
resultsFolder: string;
|
|
10
|
+
memory?: number;
|
|
11
|
+
runParameters: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface RunRecorderOptions extends RunJavaProcessOptions {
|
|
15
|
+
sourcesFolder: string;
|
|
16
|
+
typescript: boolean;
|
|
17
|
+
resourcesFolder: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const runSimulation = async (options: RunSimulationOptions): Promise<void> => {
|
|
21
|
+
logger.info(`Running a Gatling simulation with options:
|
|
22
|
+
- simulation: ${options.simulation}
|
|
23
|
+
- bundleFile: ${options.bundleFile}
|
|
24
|
+
- resourcesFolder: ${options.resourcesFolder}
|
|
25
|
+
- resultsFolder: ${options.resultsFolder}`);
|
|
26
|
+
|
|
27
|
+
const additionalClasspathElements = [options.resourcesFolder];
|
|
28
|
+
const jitTuningArgs = ["-XX:JVMCINativeLibraryThreadFraction=0.8", "-Dgraal.MethodInlineBailoutLimit=500"];
|
|
29
|
+
const memoryArgs = options.memory !== undefined ? [`-Xms${options.memory}M`, `-Xmx${options.memory}M`] : [];
|
|
30
|
+
const javaArgs = [
|
|
31
|
+
...Object.entries(options.runParameters).map(([key, value]) => `-D${key}=${value}`),
|
|
32
|
+
`-Dgatling.js.bundle.filePath=${options.bundleFile}`,
|
|
33
|
+
`-Dgatling.js.simulation=${options.simulation}`,
|
|
34
|
+
...jitTuningArgs,
|
|
35
|
+
...memoryArgs
|
|
36
|
+
];
|
|
37
|
+
const simulationArgs = [
|
|
38
|
+
"--results-folder",
|
|
39
|
+
options.resultsFolder,
|
|
40
|
+
"--simulation",
|
|
41
|
+
"io.gatling.js.JsSimulation",
|
|
42
|
+
"--launcher",
|
|
43
|
+
"gatling-js-cli",
|
|
44
|
+
"--build-tool-version",
|
|
45
|
+
versions.gatling.jsAdapter
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return runJavaProcess(options, "io.gatling.app.Gatling", additionalClasspathElements, javaArgs, simulationArgs);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const runRecorder = async (options: RunRecorderOptions): Promise<void> => {
|
|
52
|
+
logger.info(`Running the Gatling Recorder with options:
|
|
53
|
+
- sourcesFolder: ${options.sourcesFolder}
|
|
54
|
+
- resourcesFolder: ${options.resourcesFolder}
|
|
55
|
+
- typescript: ${options.typescript}`);
|
|
56
|
+
|
|
57
|
+
const recorderArgs = [
|
|
58
|
+
"--simulations-folder",
|
|
59
|
+
options.sourcesFolder,
|
|
60
|
+
"--resources-folder",
|
|
61
|
+
options.resourcesFolder,
|
|
62
|
+
"--format",
|
|
63
|
+
options.typescript ? "typescript" : "javascript"
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
return runJavaProcess(options, "io.gatling.recorder.GatlingRecorder", [], [], recorderArgs);
|
|
67
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
|
|
3
|
+
export interface SimulationFile {
|
|
4
|
+
path: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: "javascript" | "typescript";
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const findSimulations = async (sourcesFolder: string): Promise<Array<SimulationFile>> => {
|
|
10
|
+
const children = await fs.readdir(sourcesFolder, { recursive: false });
|
|
11
|
+
const simulations = children
|
|
12
|
+
.filter((path) => path.endsWith(".gatling.js") || path.endsWith(".gatling.ts"))
|
|
13
|
+
.map(
|
|
14
|
+
(path): SimulationFile => ({
|
|
15
|
+
path,
|
|
16
|
+
name: path.slice(0, -11),
|
|
17
|
+
type: path.endsWith(".ts") ? "typescript" : "javascript"
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
const duplicates = simulations.filter(
|
|
21
|
+
(value, index) => simulations.findIndex((other) => other.name === value.name) !== index
|
|
22
|
+
);
|
|
23
|
+
if (duplicates.length > 0) {
|
|
24
|
+
throw Error(
|
|
25
|
+
`Found ambiguous simulation name(s) ${duplicates.map((s) => s.name)}: found as both *.gatling.js and *.gatling.ts file(s)`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return simulations;
|
|
29
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const options_1 = require("./options");
|
|
4
|
+
const simulations_1 = require("../simulations");
|
|
5
|
+
const bundle_1 = require("../bundle");
|
|
6
|
+
exports.default = (program) => {
|
|
7
|
+
program
|
|
8
|
+
.command("build")
|
|
9
|
+
.description("Build Gatling simulations")
|
|
10
|
+
.addOption(options_1.sourcesFolderOption)
|
|
11
|
+
.addOption(options_1.bundleFileOption)
|
|
12
|
+
.addOption(options_1.typescriptOption)
|
|
13
|
+
.action(async (options) => {
|
|
14
|
+
const sourcesFolder = (0, options_1.sourcesFolderOptionValue)(options);
|
|
15
|
+
const bundleFile = (0, options_1.bundleFileOptionValue)(options);
|
|
16
|
+
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
17
|
+
const typescript = (0, options_1.typescriptOptionValueWithDefaults)(options, simulations);
|
|
18
|
+
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const options_1 = require("./options");
|
|
4
|
+
const simulations_1 = require("../simulations");
|
|
5
|
+
const dependencies_1 = require("../dependencies");
|
|
6
|
+
const bundle_1 = require("../bundle");
|
|
7
|
+
const enterprise_1 = require("../enterprise");
|
|
8
|
+
exports.default = (program) => {
|
|
9
|
+
program
|
|
10
|
+
.command("enterprise-deploy")
|
|
11
|
+
.description("Deploy a package and configured simulations")
|
|
12
|
+
.addOption(options_1.sourcesFolderOption)
|
|
13
|
+
.addOption(options_1.resourcesFolderOption)
|
|
14
|
+
.addOption(options_1.bundleFileOption)
|
|
15
|
+
.addOption(options_1.resultsFolderOption)
|
|
16
|
+
.addOption(options_1.typescriptOption)
|
|
17
|
+
.addOption(options_1.gatlingHomeOption)
|
|
18
|
+
// Base
|
|
19
|
+
.addOption(options_1.urlOption)
|
|
20
|
+
.addOption(options_1.apiTokenOption)
|
|
21
|
+
// Plugin configuration
|
|
22
|
+
.addOption(options_1.controlPlaneUrlOption)
|
|
23
|
+
.addOption(options_1.nonInteractiveOption)
|
|
24
|
+
// Descriptor file
|
|
25
|
+
.addOption(options_1.packageDescriptorFilenameOption)
|
|
26
|
+
// Deployment info
|
|
27
|
+
.addOption(options_1.packageFileOption)
|
|
28
|
+
.action(async (options) => {
|
|
29
|
+
const sourcesFolder = (0, options_1.sourcesFolderOptionValue)(options);
|
|
30
|
+
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
31
|
+
const typescript = (0, options_1.typescriptOptionValueWithDefaults)(options, simulations);
|
|
32
|
+
const resourcesFolder = (0, options_1.resourcesFolderOptionValue)(options);
|
|
33
|
+
const bundleFile = (0, options_1.bundleFileOptionValue)(options);
|
|
34
|
+
const resultsFolder = (0, options_1.resultsFolderOptionValue)(options);
|
|
35
|
+
const gatlingHome = (0, options_1.gatlingHomeOptionValueWithDefaults)(options);
|
|
36
|
+
const url = (0, options_1.urlOptionValue)(options);
|
|
37
|
+
const apiToken = (0, options_1.apiTokenOptionValue)(options);
|
|
38
|
+
const controlPlaneUrl = (0, options_1.controlPlaneUrlOptionValue)(options);
|
|
39
|
+
const nonInteractive = (0, options_1.nonInteractiveOptionValue)(options);
|
|
40
|
+
const packageDescriptorFilename = (0, options_1.packageDescriptorFilenameOptionValue)(options);
|
|
41
|
+
const packageFile = (0, options_1.packageFileOptionValue)(options);
|
|
42
|
+
const { graalvmHome, jvmClasspath } = await (0, dependencies_1.installGatlingJs)({ gatlingHome });
|
|
43
|
+
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|
|
44
|
+
await (0, enterprise_1.enterprisePackage)({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
45
|
+
await (0, enterprise_1.enterpriseDeploy)({
|
|
46
|
+
graalvmHome,
|
|
47
|
+
jvmClasspath,
|
|
48
|
+
bundleFile,
|
|
49
|
+
resourcesFolder,
|
|
50
|
+
resultsFolder,
|
|
51
|
+
url,
|
|
52
|
+
apiToken,
|
|
53
|
+
controlPlaneUrl,
|
|
54
|
+
nonInteractive,
|
|
55
|
+
packageDescriptorFilename,
|
|
56
|
+
packageFile
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const options_1 = require("./options");
|
|
4
|
+
const simulations_1 = require("../simulations");
|
|
5
|
+
const bundle_1 = require("../bundle");
|
|
6
|
+
const enterprise_1 = require("../enterprise");
|
|
7
|
+
exports.default = (program) => {
|
|
8
|
+
program
|
|
9
|
+
.command("enterprise-package")
|
|
10
|
+
.description("Build Gatling simulations and package them for Gatling Enterprise")
|
|
11
|
+
.addOption(options_1.sourcesFolderOption)
|
|
12
|
+
.addOption(options_1.resourcesFolderOption)
|
|
13
|
+
.addOption(options_1.bundleFileOption)
|
|
14
|
+
.addOption(options_1.packageFileOption)
|
|
15
|
+
.addOption(options_1.typescriptOption)
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
const sourcesFolder = (0, options_1.sourcesFolderOptionValue)(options);
|
|
18
|
+
const resourcesFolder = (0, options_1.resourcesFolderOptionValue)(options);
|
|
19
|
+
const bundleFile = (0, options_1.bundleFileOptionValue)(options);
|
|
20
|
+
const packageFile = (0, options_1.packageFileOptionValue)(options);
|
|
21
|
+
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
22
|
+
const typescript = (0, options_1.typescriptOptionValueWithDefaults)(options, simulations);
|
|
23
|
+
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|
|
24
|
+
await (0, enterprise_1.enterprisePackage)({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const options_1 = require("./options");
|
|
4
|
+
const simulations_1 = require("../simulations");
|
|
5
|
+
const dependencies_1 = require("../dependencies");
|
|
6
|
+
const bundle_1 = require("../bundle");
|
|
7
|
+
const enterprise_1 = require("../enterprise");
|
|
8
|
+
exports.default = (program) => {
|
|
9
|
+
program
|
|
10
|
+
.command("enterprise-start")
|
|
11
|
+
.description("Start a simulation deployed with `enterprise-deploy`")
|
|
12
|
+
.addOption(options_1.sourcesFolderOption)
|
|
13
|
+
.addOption(options_1.resourcesFolderOption)
|
|
14
|
+
.addOption(options_1.bundleFileOption)
|
|
15
|
+
.addOption(options_1.resultsFolderOption)
|
|
16
|
+
.addOption(options_1.typescriptOption)
|
|
17
|
+
.addOption(options_1.gatlingHomeOption)
|
|
18
|
+
// Base
|
|
19
|
+
.addOption(options_1.urlOption)
|
|
20
|
+
.addOption(options_1.apiTokenOption)
|
|
21
|
+
// Plugin configuration
|
|
22
|
+
.addOption(options_1.controlPlaneUrlOption)
|
|
23
|
+
.addOption(options_1.nonInteractiveOption)
|
|
24
|
+
// Descriptor file
|
|
25
|
+
.addOption(options_1.packageDescriptorFilenameOption)
|
|
26
|
+
// Deployment info
|
|
27
|
+
.addOption(options_1.packageFileOption)
|
|
28
|
+
// Start
|
|
29
|
+
.addOption(options_1.enterpriseSimulationOption)
|
|
30
|
+
.addOption(options_1.runTitleOption)
|
|
31
|
+
.addOption(options_1.runDescriptionOption)
|
|
32
|
+
.addOption(options_1.waitForRunEndOption)
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const sourcesFolder = (0, options_1.sourcesFolderOptionValue)(options);
|
|
35
|
+
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
36
|
+
const typescript = (0, options_1.typescriptOptionValueWithDefaults)(options, simulations);
|
|
37
|
+
const resourcesFolder = (0, options_1.resourcesFolderOptionValue)(options);
|
|
38
|
+
const bundleFile = (0, options_1.bundleFileOptionValue)(options);
|
|
39
|
+
const resultsFolder = (0, options_1.resultsFolderOptionValue)(options);
|
|
40
|
+
const gatlingHome = (0, options_1.gatlingHomeOptionValueWithDefaults)(options);
|
|
41
|
+
const url = (0, options_1.urlOptionValue)(options);
|
|
42
|
+
const apiToken = (0, options_1.apiTokenOptionValue)(options);
|
|
43
|
+
const controlPlaneUrl = (0, options_1.controlPlaneUrlOptionValue)(options);
|
|
44
|
+
const nonInteractive = (0, options_1.nonInteractiveOptionValue)(options);
|
|
45
|
+
const packageDescriptorFilename = (0, options_1.packageDescriptorFilenameOptionValue)(options);
|
|
46
|
+
const packageFile = (0, options_1.packageFileOptionValue)(options);
|
|
47
|
+
const enterpriseSimulation = (0, options_1.enterpriseSimulationOptionValue)(options);
|
|
48
|
+
const runTitle = (0, options_1.runTitleOptionValue)(options);
|
|
49
|
+
const runDescription = (0, options_1.runDescriptionOptionValue)(options);
|
|
50
|
+
const waitForRunEnd = (0, options_1.waitForRunEndOptionValue)(options);
|
|
51
|
+
if ((0, options_1.nonInteractiveOptionValue)(options) && enterpriseSimulation === undefined) {
|
|
52
|
+
throw new Error(`No simulation specified when using non-interactive mode`);
|
|
53
|
+
}
|
|
54
|
+
const { graalvmHome, jvmClasspath } = await (0, dependencies_1.installGatlingJs)({ gatlingHome });
|
|
55
|
+
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|
|
56
|
+
await (0, enterprise_1.enterprisePackage)({ bundleFile, resourcesFolder, packageFile, simulations });
|
|
57
|
+
await (0, enterprise_1.enterpriseStart)({
|
|
58
|
+
graalvmHome,
|
|
59
|
+
jvmClasspath,
|
|
60
|
+
bundleFile,
|
|
61
|
+
resourcesFolder,
|
|
62
|
+
resultsFolder,
|
|
63
|
+
url,
|
|
64
|
+
apiToken,
|
|
65
|
+
controlPlaneUrl,
|
|
66
|
+
nonInteractive,
|
|
67
|
+
packageDescriptorFilename,
|
|
68
|
+
packageFile,
|
|
69
|
+
enterpriseSimulation,
|
|
70
|
+
runTitle,
|
|
71
|
+
runDescription,
|
|
72
|
+
waitForRunEnd
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.program = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const install_1 = __importDefault(require("./install"));
|
|
9
|
+
const build_1 = __importDefault(require("./build"));
|
|
10
|
+
const runOnly_1 = __importDefault(require("./runOnly"));
|
|
11
|
+
const run_1 = __importDefault(require("./run"));
|
|
12
|
+
const recorder_1 = __importDefault(require("./recorder"));
|
|
13
|
+
const enterprisePackage_1 = __importDefault(require("./enterprisePackage"));
|
|
14
|
+
const enterpriseDeploy_1 = __importDefault(require("./enterpriseDeploy"));
|
|
15
|
+
const enterpriseStart_1 = __importDefault(require("./enterpriseStart"));
|
|
16
|
+
const dependencies_1 = require("../dependencies");
|
|
17
|
+
exports.program = new commander_1.Command()
|
|
18
|
+
.name("gatling-js-cli")
|
|
19
|
+
.version(dependencies_1.versions.gatling.jsAdapter)
|
|
20
|
+
.description("The Gatling Javascript run & packaging tool");
|
|
21
|
+
(0, install_1.default)(exports.program);
|
|
22
|
+
(0, build_1.default)(exports.program);
|
|
23
|
+
(0, runOnly_1.default)(exports.program);
|
|
24
|
+
(0, run_1.default)(exports.program);
|
|
25
|
+
(0, recorder_1.default)(exports.program);
|
|
26
|
+
(0, enterprisePackage_1.default)(exports.program);
|
|
27
|
+
(0, enterpriseDeploy_1.default)(exports.program);
|
|
28
|
+
(0, enterpriseStart_1.default)(exports.program);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const options_1 = require("./options");
|
|
4
|
+
const dependencies_1 = require("../dependencies");
|
|
5
|
+
const log_1 = require("../log");
|
|
6
|
+
exports.default = (program) => {
|
|
7
|
+
program
|
|
8
|
+
.command("install")
|
|
9
|
+
.description("Install all required components and dependencies for Gatling")
|
|
10
|
+
.addOption(options_1.gatlingHomeOption)
|
|
11
|
+
.action(async (options) => {
|
|
12
|
+
const gatlingHome = (0, options_1.gatlingHomeOptionValueWithDefaults)(options);
|
|
13
|
+
const { graalvmHome, coursierBinary, jvmClasspath } = await (0, dependencies_1.installGatlingJs)({ gatlingHome });
|
|
14
|
+
log_1.logger.info(`graalvmHome=${graalvmHome}`);
|
|
15
|
+
log_1.logger.info(`coursierBinary=${coursierBinary}`);
|
|
16
|
+
log_1.logger.info(`jvmClasspath=${jvmClasspath}`);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Option, Argument } from "commander";
|
|
2
|
+
import { SimulationFile } from "../simulations";
|
|
3
|
+
export declare const gatlingHomeOption: Option;
|
|
4
|
+
export declare const gatlingHomeOptionValueWithDefaults: (options: any) => string;
|
|
5
|
+
export declare const sourcesFolderOption: Option;
|
|
6
|
+
export declare const sourcesFolderOptionValue: (options: any) => string;
|
|
7
|
+
export declare const simulationOption: Option;
|
|
8
|
+
export declare const simulationOptionValueWithDefaults: (options: any, simulationsFound: SimulationFile[], interactive: boolean) => string;
|
|
9
|
+
export declare const simulationMandatoryOption: Option;
|
|
10
|
+
export declare const simulationMandatoryOptionValue: (options: any) => string;
|
|
11
|
+
export declare const bundleFileOption: Option;
|
|
12
|
+
export declare const bundleFileOptionValue: (options: any) => string;
|
|
13
|
+
export declare const packageFileOption: Option;
|
|
14
|
+
export declare const packageFileOptionValue: (options: any) => string;
|
|
15
|
+
export declare const resourcesFolderOption: Option;
|
|
16
|
+
export declare const resourcesFolderOptionValue: (options: any) => string;
|
|
17
|
+
export declare const resultsFolderOption: Option;
|
|
18
|
+
export declare const resultsFolderOptionValue: (options: any) => string;
|
|
19
|
+
export declare const typescriptOption: Option;
|
|
20
|
+
export declare const typescriptOptionValueWithDefaults: (options: any, simulationsFound: SimulationFile[]) => boolean;
|
|
21
|
+
export declare const graalvmHomeMandatoryOption: Option;
|
|
22
|
+
export declare const graalvmHomeMandatoryOptionValue: (options: any) => string;
|
|
23
|
+
export declare const jvmClasspathMandatoryOption: Option;
|
|
24
|
+
export declare const jvmClasspathMandatoryOptionValue: (options: any) => string;
|
|
25
|
+
export declare const memoryOption: Option;
|
|
26
|
+
export declare const memoryOptionValue: (options: any) => number | undefined;
|
|
27
|
+
export declare const nonInteractiveOption: Option;
|
|
28
|
+
export declare const nonInteractiveOptionValue: (options: any) => boolean;
|
|
29
|
+
export declare const runParametersArgument: Argument;
|
|
30
|
+
export declare const parseRunParametersArgument: (args: string[]) => Record<string, string>;
|
|
31
|
+
export declare const urlOption: Option;
|
|
32
|
+
export declare const urlOptionValue: (options: any) => string;
|
|
33
|
+
export declare const apiTokenOption: Option;
|
|
34
|
+
export declare const apiTokenOptionValue: (options: any) => string | undefined;
|
|
35
|
+
export declare const controlPlaneUrlOption: Option;
|
|
36
|
+
export declare const controlPlaneUrlOptionValue: (options: any) => string | undefined;
|
|
37
|
+
export declare const packageDescriptorFilenameOption: Option;
|
|
38
|
+
export declare const packageDescriptorFilenameOptionValue: (options: any) => string;
|
|
39
|
+
export declare const enterpriseSimulationOption: Option;
|
|
40
|
+
export declare const enterpriseSimulationOptionValue: (options: any) => string | undefined;
|
|
41
|
+
export declare const runTitleOption: Option;
|
|
42
|
+
export declare const runTitleOptionValue: (options: any) => string | undefined;
|
|
43
|
+
export declare const runDescriptionOption: Option;
|
|
44
|
+
export declare const runDescriptionOptionValue: (options: any) => string | undefined;
|
|
45
|
+
export declare const waitForRunEndOption: Option;
|
|
46
|
+
export declare const waitForRunEndOptionValue: (options: any) => boolean;
|