@loadmill/core 0.3.51 → 0.3.52

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.
Files changed (59) hide show
  1. package/package.json +2 -2
  2. package/src/conf/defaults.ts +0 -25
  3. package/src/conf/extrema.ts +0 -36
  4. package/src/conf/index.ts +0 -95
  5. package/src/conf/notifications.ts +0 -17
  6. package/src/conf/types.ts +0 -100
  7. package/src/conf/validate.ts +0 -559
  8. package/src/distributed-logger-reporter.ts +0 -19
  9. package/src/echo/firehose.ts +0 -64
  10. package/src/echo/index.ts +0 -4
  11. package/src/echo/stats.ts +0 -84
  12. package/src/har/index.ts +0 -81
  13. package/src/multipart-form-data/form-data-utils.ts +0 -81
  14. package/src/multipart-form-data/is-binary-file.ts +0 -206
  15. package/src/multipart-form-data/multipart-text-to-post-form-data.ts +0 -149
  16. package/src/parameters/extractions.ts +0 -53
  17. package/src/parameters/extractors/cheerio-extractor.ts +0 -57
  18. package/src/parameters/extractors/expression-extractor.ts +0 -13
  19. package/src/parameters/extractors/extractor.ts +0 -3
  20. package/src/parameters/extractors/header-extractor.ts +0 -24
  21. package/src/parameters/extractors/index.ts +0 -10
  22. package/src/parameters/extractors/json-path-extractor.ts +0 -63
  23. package/src/parameters/extractors/parametrized-extractor.ts +0 -27
  24. package/src/parameters/extractors/regex-extractor.ts +0 -18
  25. package/src/parameters/extractors/regex-matcher.ts +0 -17
  26. package/src/parameters/extractors/ws-extractor.ts +0 -91
  27. package/src/parameters/generate-random.ts +0 -114
  28. package/src/parameters/index.ts +0 -624
  29. package/src/parameters/json-path-utils.ts +0 -20
  30. package/src/parameters/operators/binary-operator.ts +0 -23
  31. package/src/parameters/operators/index.ts +0 -39
  32. package/src/parameters/parameter-functions/boolean-parameter-functions.ts +0 -24
  33. package/src/parameters/parameter-functions/crypto.ts +0 -55
  34. package/src/parameters/parameter-functions/json-schema.ts +0 -29
  35. package/src/parameters/parameter-functions/numeric-input-parameter-functions.ts +0 -22
  36. package/src/parameters/parameter-functions/numeric-parameter-functions.ts +0 -37
  37. package/src/parameters/parameter-functions/parameter-function-utils.ts +0 -55
  38. package/src/parameters/parameter-functions/parameter-function.ts +0 -7
  39. package/src/parameters/parameter-functions/parameter-functions.ts +0 -54
  40. package/src/parameters/parameter-functions/random-parameter-functions.ts +0 -22
  41. package/src/parameters/parameter-functions/textual-parameter-functions.ts +0 -464
  42. package/src/parameters/parameter-regex-providers.ts +0 -78
  43. package/src/parameters/resolvers/random-parameters-resolver.ts +0 -8
  44. package/src/parameters/type.ts +0 -7
  45. package/src/parameters/value-utils.ts +0 -47
  46. package/src/request/index.ts +0 -526
  47. package/src/schema/json-schema-generator.ts +0 -76
  48. package/test/conf/validate.spec.js +0 -141
  49. package/test/har/is-har.spec.js +0 -33
  50. package/test/multipart-form-data/form-data-utils.spec.ts +0 -142
  51. package/test/multipart-form-data/resources/multipart-form-data-file-text-content.json +0 -5
  52. package/test/parameters/builtin-functions.spec.js +0 -85
  53. package/test/parameters/json-path-utils.spec.ts +0 -50
  54. package/test/parameters/parameter-functions.spec.js +0 -48
  55. package/test/parameters/parameter-utils.spec.js +0 -185
  56. package/test/parameters/regex-functions.spec.ts +0 -57
  57. package/test/parameters/value-utils.spec.js +0 -73
  58. package/test/schema/json-schema-generator.spec.js +0 -227
  59. package/tsconfig.json +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadmill/core",
3
- "version": "0.3.51",
3
+ "version": "0.3.52",
4
4
  "description": "Loadmill core library",
5
5
  "scripts": {
6
6
  "ts-watch": "rimraf dist && tsc -w -p tsconfig.json",
@@ -22,7 +22,7 @@
22
22
  "@aws-sdk/client-cognito-identity": "^3.58.0",
23
23
  "@aws-sdk/client-firehose": "^3.58.0",
24
24
  "@aws-sdk/types": "^3.55.0",
25
- "@loadmill/universal": "0.3.46",
25
+ "@loadmill/universal": "0.3.47",
26
26
  "cheerio": "^0.22.0",
27
27
  "crypto-js": "^4.1.1",
28
28
  "http-headers-validation": "^0.0.1",
@@ -1,25 +0,0 @@
1
- import {
2
- HIGH_MIN_RAMP_UP,
3
- MIN_CONCURRENCY,
4
- MIN_ITERATION_DELAY,
5
- MIN_REQUEST_DELAY,
6
- MAX_UNVERIFIED_CONCURRENCY,
7
- MIN_DURATION_MINUTES,
8
- HIGH_MIN_RAMP_UP_MINUTES,
9
- } from './extrema';
10
-
11
- const isProduction = process.env.NODE_ENV === 'production';
12
-
13
- export const DEFAULT_DURATION = 60000,
14
- DEFAULT_DURATION_MINUTES = isProduction
15
- ? MIN_DURATION_MINUTES + 1
16
- : MIN_DURATION_MINUTES,
17
- DEFAULT_RAMP_UP = HIGH_MIN_RAMP_UP,
18
- DEFAULT_RAMP_UP_MINUTES = HIGH_MIN_RAMP_UP_MINUTES,
19
- DEFAULT_CONCURRENCY = isProduction
20
- ? MAX_UNVERIFIED_CONCURRENCY
21
- : MIN_CONCURRENCY,
22
- DEFAULT_RPS = 1,
23
- DEFAULT_REQUEST_DELAY = MIN_REQUEST_DELAY * 2,
24
- DEFAULT_ITERATION_DELAY = MIN_ITERATION_DELAY * 2,
25
- DEFAULT_CACHE_CONTROL = 'no-cache, no-store, must-revalidate, max-age=0';
@@ -1,36 +0,0 @@
1
- export const MIN_DURATION = 60 * 1000,
2
- MIN_DURATION_MINUTES = 1,
3
- MAX_DURATION = 24 * 60 * 60 * 1000,
4
- MIN_REQUEST_LOOPS_ITERATIONS = 1,
5
- MAX_REQUEST_LOOPS_ITERATIONS = 100,
6
- MIN_MAX_ITERATIONS = 5,
7
- MAX_MAX_ITERATIONS = Number.MAX_SAFE_INTEGER / 2,
8
- MIN_REQUEST_DELAY = 50,
9
- MAX_REQUEST_DELAY = 300000,
10
- MIN_ITERATION_DELAY = 500,
11
- MAX_ITERATION_DELAY = 120000,
12
- MAX_EXECUTABLE_REQUESTS = 100,
13
- MAX_API_TEST_EXECUTABLE_REQUESTS = 200,
14
- MAX_PROCESSABLE_REQUESTS = 1000,
15
- MAX_LOAD_REQUEST_BODY_LENGTH = 100 * 1024, // 100KB
16
- MAX_API_REQUEST_BODY_LENGTH = 5000 * 1024, // 5MB
17
- MAX_RESPONSE_BYTES = 20 * 1024 * 1024,
18
- MAX_RESPONSE_COLLECT = 110 * 1024,
19
- DOUBLE_MAX_RESPONSE_COLLECT = 2 * MAX_RESPONSE_COLLECT,
20
- MIN_REQUEST_TIMEOUT = 100,
21
- MAX_REQUEST_TIMEOUT = 120000,
22
- MAX_UNVERIFIED_CONCURRENCY = 5,
23
- MAX_UNVERIFIED_DURATION_MINUTES = 5,
24
- MAX_UNVERIFIED_DURATION = MAX_UNVERIFIED_DURATION_MINUTES * 60 * 1000,
25
- MIN_CONCURRENCY = 1,
26
- MAX_CONCURRENCY = 100000,
27
- MIN_RPS = 1,
28
- MAX_RPS = MAX_CONCURRENCY / 2,
29
- HIGH_MIN_RAMP_UP = 60 * 1000,
30
- HIGH_MIN_RAMP_UP_MINUTES = 1;
31
-
32
- export function rampUpExtrema(duration = MIN_DURATION, concurrency = MIN_CONCURRENCY) {
33
- const min = concurrency < 200 ? 0 : HIGH_MIN_RAMP_UP;
34
-
35
- return { min, max: duration };
36
- }
package/src/conf/index.ts DELETED
@@ -1,95 +0,0 @@
1
- import {
2
- EmailNotification,
3
- TestRunNotification,
4
- SlackChannel,
5
- Destination,
6
- NotificationTypes,
7
- NotificationMode,
8
- NotificationModeLike,
9
- TestConfLike,
10
- TestEntity,
11
- } from './types';
12
- import { validate, EntryValidations } from './validate';
13
- import validator from 'validator';
14
- import { MAX_REQUEST_DELAY, MIN_REQUEST_DELAY } from './extrema';
15
- import { DEFAULT_REQUEST_DELAY } from './defaults';
16
- import * as confExtrema from './extrema';
17
- import * as confDefaults from './defaults';
18
- import { LoadmillRequest } from '../request';
19
- import { emailToLocalNotifications } from './notifications';
20
-
21
- export function isParameterCandidate(value?: number | string): value is string {
22
- return typeof value === 'string' && !validator.isNumeric(value.charAt(0));
23
- }
24
-
25
- export function validateIntegerDelay(
26
- delay: number | string,
27
- fieldName: string | false = 'delay'
28
- ) {
29
- return validate.integer(
30
- delay,
31
- fieldName,
32
- MIN_REQUEST_DELAY,
33
- MAX_REQUEST_DELAY
34
- );
35
- }
36
-
37
- export function minimalRemainingDuration(
38
- iterationDelay: number,
39
- requests: LoadmillRequest[],
40
- skipCount = 1
41
- ) {
42
- const requestsDelay =
43
- skipCount >= requests.length
44
- ? 0
45
- : requests
46
- .slice(skipCount)
47
- .map((req) =>
48
- isParameterCandidate(req.delay)
49
- ? MIN_REQUEST_DELAY
50
- : Number(req.delay || DEFAULT_REQUEST_DELAY)
51
- )
52
- .reduce((x, y) => x + y, 0);
53
-
54
- return iterationDelay + requestsDelay;
55
- }
56
-
57
- /**
58
- * Not counting duration of actual request round trip + response processing.
59
- */
60
- export function minimalIterationDuration(
61
- iterationDelay: number,
62
- requests: LoadmillRequest[]
63
- ) {
64
- return minimalRemainingDuration(iterationDelay, requests);
65
- }
66
-
67
- const reportDelayFactor = 1,
68
- minReportDelay = 3000,
69
- MAX_REPORT_DELAY = 20000;
70
-
71
- export function reportDelay(iterationDelay: number, requests: LoadmillRequest[]) {
72
- const factoredWorkDelay =
73
- reportDelayFactor * minimalIterationDuration(iterationDelay, requests);
74
-
75
- return minReportDelay <= factoredWorkDelay
76
- ? Math.min(factoredWorkDelay, MAX_REPORT_DELAY)
77
- : minReportDelay;
78
- }
79
-
80
- export {
81
- validate,
82
- confDefaults,
83
- confExtrema,
84
- TestConfLike,
85
- EmailNotification,
86
- TestRunNotification,
87
- SlackChannel,
88
- Destination,
89
- NotificationTypes,
90
- NotificationMode,
91
- NotificationModeLike,
92
- EntryValidations,
93
- emailToLocalNotifications,
94
- TestEntity,
95
- };
@@ -1,17 +0,0 @@
1
- import { EmailNotification, TestRunNotification, NotificationTypes } from './types';
2
-
3
- export const emailToLocalNotifications = (
4
- notifications: EmailNotification[] | TestRunNotification[] = []
5
- ) : TestRunNotification[] => {
6
- return notifications.map((n) => n.email ? emailToLocalNotification(n) : n);
7
- };
8
-
9
- const emailToLocalNotification = (notification: EmailNotification) : TestRunNotification => {
10
- return {
11
- destination: {
12
- type: NotificationTypes.EMAIL,
13
- target: notification.email
14
- },
15
- notifyWhen: notification.notifyWhen
16
- };
17
- };
package/src/conf/types.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- AuthConf,
3
- RequestLike,
4
- LoadmillHeaders,
5
- CachePenetration
6
- } from '../request';
7
- import { Parameters } from '../parameters';
8
-
9
- export type EmailNotification = {
10
- email: string;
11
- notifyWhen: NotificationModeLike;
12
- };
13
-
14
- export type TestRunNotification = {
15
- destination: Destination;
16
- notifyWhen: NotificationModeLike;
17
- notifyBy?: NotifyBy;
18
- };
19
-
20
- export type SlackChannel = {
21
- id: string;
22
- name: string;
23
- };
24
-
25
- export type Destination = {
26
- type: NotificationTypes;
27
- target: string | SlackChannel;
28
- }
29
-
30
- export enum NotificationTypes {
31
- EMAIL = 'email',
32
- SLACK = 'slack',
33
- }
34
-
35
- export enum NotificationMode {
36
- ALL = 'ALL',
37
- PASSED = 'PASSED',
38
- FAILED = 'FAILED',
39
- }
40
-
41
- export enum NotifyBy {
42
- FLOWS = 'Flows',
43
- ENDPOINTS = 'Endpoints',
44
- }
45
-
46
- export type NotificationModeLike = keyof typeof NotificationMode;
47
-
48
- export enum TestEntity {
49
- FLOW = 'flow',
50
- SUITE = 'suite',
51
- TEST_PLAN = 'test plan',
52
- LOAD = 'load',
53
- }
54
-
55
- export interface TestConfLike {
56
- requests: RequestLike[];
57
-
58
- meta?: {
59
- description?: string;
60
- dependencies?: ConfDependency[];
61
- dependenciesData?: ConfDependencyData[];
62
- };
63
-
64
- auth?: AuthConf;
65
- useCookies?: boolean;
66
- useProxy?: boolean;
67
- maxFlakyFlowRetries?: number;
68
- useStaticIp?: boolean;
69
- skipLoginFlow?: boolean;
70
- parameterPools?: string[];
71
- domainsWhiteList?: string[];
72
- cachePenetration?: CachePenetration;
73
- parameters?: Parameters | Parameters[];
74
- loginFlow?: RequestLike[];
75
- authenticationHeaders?: LoadmillHeaders | LoadmillHeaders[];
76
-
77
- // These are for load tests only:
78
- rampUp?: number;
79
- rps?: number;
80
- duration?: number;
81
- concurrency?: number;
82
- monitoredEnv?: string;
83
- maxIterations?: number;
84
- iterationDelay?: number | '';
85
- alwaysDistributed?: boolean;
86
- targetedCountries?: string[];
87
- notifications?: EmailNotification[] | TestRunNotification[];
88
- }
89
-
90
- export type ConfDependency = {
91
- sharedFlowId: string,
92
- index: number,
93
- order: number,
94
- };
95
-
96
- export type ConfDependencyData = {
97
- id: string;
98
- description: string;
99
- conf: any;
100
- };