2019-07-23 00:29:26 +00:00
|
|
|
/*
|
|
|
|
|
* Program options.
|
2020-06-09 07:38:23 +00:00
|
|
|
* https://k6.io/docs/using-k6/options
|
2019-07-23 00:29:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { CipherSuite } from './http';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Program options.
|
2020-06-09 07:38:23 +00:00
|
|
|
* https://k6.io/docs/using-k6/options
|
2019-07-23 00:29:26 +00:00
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export interface Options {
|
2019-07-23 00:29:26 +00:00
|
|
|
/** Maximum parallel `http.batch()` connections per VU. */
|
2020-06-16 09:30:53 +00:00
|
|
|
batch?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Maximum parallel `http.batch()` host connections per VU. */
|
2020-06-16 09:30:53 +00:00
|
|
|
batchPerHost?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Blacklist IP ranges from being called. */
|
2020-06-16 09:30:53 +00:00
|
|
|
blacklistIPs?: string[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Discard response bodies. */
|
2020-06-16 09:30:53 +00:00
|
|
|
discardResponseBodies?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Test duration. */
|
2020-06-16 09:30:53 +00:00
|
|
|
duration?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Third party collector configuration. */
|
2020-06-16 09:30:53 +00:00
|
|
|
ext?: { [name: string]: CollectorOptions };
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Static hostname mapping. */
|
2020-06-16 09:30:53 +00:00
|
|
|
hosts?: { [name: string]: string };
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Log all HTTP requests and responses. */
|
2020-06-16 09:30:53 +00:00
|
|
|
httpDebug?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Disable TLS verification. Insecure. */
|
2020-06-16 09:30:53 +00:00
|
|
|
insecureSkipTLSVerify?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Iterations to execute. */
|
2020-06-16 09:30:53 +00:00
|
|
|
iterations?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Persist the k6 process after test completion. */
|
2020-06-16 09:30:53 +00:00
|
|
|
linger?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Maximum HTTP redirects to follow. */
|
2020-06-16 09:30:53 +00:00
|
|
|
maxRedirects?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Minimum test iteration duration. */
|
2020-06-16 09:30:53 +00:00
|
|
|
minIterationDuration?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Disable keepalive connections. */
|
2020-06-16 09:30:53 +00:00
|
|
|
noConnectionReuse?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Disable usage reports. */
|
2020-06-16 09:30:53 +00:00
|
|
|
noUsageReport?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Disable cross-VU TCP connection reuse. */
|
2020-06-16 09:30:53 +00:00
|
|
|
noVUConnectionReuse?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Start test in paused state. */
|
2020-06-16 09:30:53 +00:00
|
|
|
paused?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Maximum requests per second across all VUs. */
|
2020-06-16 09:30:53 +00:00
|
|
|
rps?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Setup function timeout. */
|
2020-06-16 09:30:53 +00:00
|
|
|
setupTimeout?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Test stage specifications. Program of target VU stages. */
|
2020-06-16 09:30:53 +00:00
|
|
|
stages?: Stage[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Define stats for trend metrics. */
|
2020-06-16 09:30:53 +00:00
|
|
|
summaryTrendStats?: string[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Which system tags to include in collected metrics. */
|
2020-06-16 09:30:53 +00:00
|
|
|
systemTags?: string[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Tags to set test wide across all metrics. */
|
2020-06-16 09:30:53 +00:00
|
|
|
tags?: { [name: string]: string };
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Teardown function timeout. */
|
2020-06-16 09:30:53 +00:00
|
|
|
teardownTimeout?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Threshold specifications. Defines pass and fail conditions. */
|
2020-06-16 09:30:53 +00:00
|
|
|
thresholds?: { [name: string]: Threshold[] };
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Throw error on failed HTTP request. */
|
2020-06-16 09:30:53 +00:00
|
|
|
throw?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** TLS client certificates. */
|
2020-06-16 09:30:53 +00:00
|
|
|
tlsAuth?: Certificate[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Allowed TLS cipher suites. */
|
2020-06-16 09:30:53 +00:00
|
|
|
tlsCipherSuites?: CipherSuite[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Allowed TLS version. Use `http.SSL_*` `http.TLS_*` constants. */
|
2020-06-16 09:30:53 +00:00
|
|
|
tlsVersion?: string | { min: string; max: string };
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** User agent string to include in HTTP requests. */
|
2020-06-16 09:30:53 +00:00
|
|
|
userAgent?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Number of VUs to run concurrently. */
|
2020-06-16 09:30:53 +00:00
|
|
|
vus?: number;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Maximum VUs. Preallocates VUs to enable faster scaling. */
|
2020-06-16 09:30:53 +00:00
|
|
|
vusMax?: number;
|
2019-06-26 16:40:45 +00:00
|
|
|
}
|
|
|
|
|
|
2019-07-23 00:29:26 +00:00
|
|
|
/**
|
|
|
|
|
* Third party collector configuration.
|
|
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export interface CollectorOptions {
|
|
|
|
|
[name: string]: any;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-23 00:29:26 +00:00
|
|
|
/**
|
|
|
|
|
* Test stage.
|
|
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export interface Stage {
|
2019-07-23 00:29:26 +00:00
|
|
|
/** Stage duration. */
|
2019-06-26 16:40:45 +00:00
|
|
|
duration: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Target number of VUs. */
|
2019-06-26 16:40:45 +00:00
|
|
|
target: number;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-23 00:29:26 +00:00
|
|
|
/**
|
|
|
|
|
* Threshold specification.
|
2020-06-09 07:38:23 +00:00
|
|
|
* https://k6.io/docs/using-k6/thresholds
|
2019-07-23 00:29:26 +00:00
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export type Threshold = string | ObjectThreshold;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Object form threshold specification.
|
2020-06-09 07:38:23 +00:00
|
|
|
* https://k6.io/docs/using-k6/thresholds
|
2019-07-23 00:29:26 +00:00
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export interface ObjectThreshold {
|
2019-07-23 00:29:26 +00:00
|
|
|
/** Abort test if threshold violated. */
|
2019-06-26 16:40:45 +00:00
|
|
|
abortOnFail?: boolean;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Duration to delay evaluation. Enables collecting additional metrics. */
|
2019-06-26 16:40:45 +00:00
|
|
|
delayAbortEval?: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Threshold expression. */
|
2019-06-26 16:40:45 +00:00
|
|
|
threshold: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-23 00:29:26 +00:00
|
|
|
/**
|
|
|
|
|
* TLS client certificate.
|
|
|
|
|
*/
|
2019-06-26 16:40:45 +00:00
|
|
|
export interface Certificate {
|
2019-07-23 00:29:26 +00:00
|
|
|
/** PEM encoded certificate. */
|
2019-06-26 16:40:45 +00:00
|
|
|
cert: string;
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** Domains certificate is valid for. */
|
2019-06-26 16:40:45 +00:00
|
|
|
domains: string[];
|
2019-07-23 00:29:26 +00:00
|
|
|
|
|
|
|
|
/** PEM encoded certificate key. */
|
2019-06-26 16:40:45 +00:00
|
|
|
key: string;
|
|
|
|
|
}
|