1.0.1 • Published 1 month ago

opengov-k6-core v1.0.1

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 month ago

Description

A robust k6 core library designed to enhance load testing capabilities. It offers extended functionalities for various protocols, custom metrics, aiming to simplify and empower performance testing for developers and QA engineers.

Technologies and tools used:

Setup

Install Node 18.16.0+ or set Node 18.16.0+ as the version to use with this project

nvm use 18.16.0

Contributing

Thank you for considering to contribute to this project! Please review the Contribution Guidelines to begin.

Testing Changes

To test changes to the library, follow these steps:

  1. Build the Project
    Run the following command to build the project:
    yarn build
  2. Package the Library
    Create a packed .tgz file of your library using:
    yarn pack
  3. Copy the Packaged File
    Copy the resulting .tgz file to the dependent project's directory.
  4. Update the Dependency
    Update the package.json in the dependent project to the path of the new .tgz file. For example:
    "dependencies": {
       "opengov-k6-core": "file:path/to/your-library.tgz"
    }```
  5. Install the Updated Package
    Install the updated package with:
    yarn install
  6. Run any Tests
    Execute the tests using any appropriate script from the package.json to ensure everything works as expected:

ThresholdMerger Class

The ThresholdMerger class is designed to manage and merge performance monitoring thresholds. It allows users to easily integrate custom thresholds while default thresholds are maintained as a fallback.

Features:

Complete Replacement:

Custom thresholds provided for a metric completely replace the existing defaults for that metric, rather than merging or appending. This ensures that custom settings are prioritized and simplifies configuration management.

Ease of Use:

Simple and intuitive method interfaces make it straightforward to merge custom thresholds with defaults.

Usage:

To use the ThresholdMerger class within the getLoadProfile function, pass the custom thresholds as the fourth argument. This argument should be an object where the keys are the metric names and the values are arrays of threshold conditions you wish to apply. Ensure that the ThresholdMerger class is properly integrated to handle these thresholds according to the specific requirements of your project.

import customThresholds from '../../../../../../load_rates/samples/rates/thresholds/customThresholds.json';
export const options: Options = getLoadProfile(
  Number(__ENV.DURATION),
  Number(__ENV.VUS),
  scenariosConfig,
  customThresholds,
);
Example of threshold file:
{
  "http_req_duration": ["p(90)<200", "p(95)<300", "avg<250"],
  "http_req_failed": ["rate<0.01"],
  "http_req_connecting": ["p(95)<50"],
  "http_req_sending": ["avg<50"],
  "http_req_receiving": ["avg<3000"]
}

FAQ

  • In case of error Error: error:0308010C:digital envelope routines::unsupported execute following command export NODE_OPTIONS=--openssl-legacy-provider

Support

  • K6 Support Channel
    • #k6-framework
  • General QCE Support
    • #team-qce-support