This repository contains a suite of patterns, tests, and supporting infrastructure for evaluating the performance of Open MCT when it's used as a front end for HTTP and WS-based telemetry sources. It's designed to be used in conjunction with the openmct-quickstart repository.
To set up your environment to use this test suite, follow these steps.
Ensure that docker
and npm
are installed on your system.
Open MCT Quickstart provides the capability of running Open MCT in a production-like configuration with a simple docker-compose up. We'll use it as the system-under-test for this repo.
- Clone the openmct-quickstart repository in a separate directory:
git clone https://github.com/scottbell/openmct-quickstart/
- Start the provided YAMCS quickstart stack with real-time data:
docker-compose up -d
- Install the k6 binaries (for example, using Homebrew on macOS). Official Guide
brew install k6
- Navigate to the tests directory and install dependencies:
cd tests npm install
Check that the following services are available:
- Open MCT: http://localhost:8040/
- YAMCS: http://localhost:8090/yamcs/
- CouchDB: http://localhost:5984/couchdb/
- Prometheus: http://localhost:9090/
- Grafana: http://localhost:3006/grafana
To verify everything is up and running, use the k6 example testcase:
npm run test:example
Execute a browser-based test script using k6:
npm run test:example:browser
Run a combined test which may include browser-based and traditional k6 tests:
npm run test:example:combined
Run a test specifically designed to search within YAMCS:
npm run test:yamcs:search
Perform a YAMCS search test that includes custom marks for tracking performance.
npm run test:yamcs:searchWithMarks
The recommended approach for creating k6-browser tests is to use the Playwright test recorder, ensuring compatibility by pinning to a specific version of the tool that supports our APIs.
- Start the Playwright inspector to record a test:
npm run test:record
- Click the
[ Record ]
button in the Playwright Inspector window. - Perform the actions of the test you wish to record.
- When finished, choose the 'Library' option in the Playwright Inspector window to export the test.
Since we're using playwright-like APIs, it's possible to use the playwright sdk to write tests to execute as a k6-browser test.
- Record HAR File of a interactive browser test Record network activity in a HAR file while interacting with Open MCT.
npm run har:record
- Convert HAR to k6 Test
Convert the recorded HAR file to a k6 test script.
npm run har:convert
- YAMCS Search Test From HAR File
Run a YAMCS search test that has been created from a HAR file recording.
npm run test:yamcs:searchfromhar
Below is a curated list of resources that have provided inspiration and information for this repository: