{"id":22772321,"url":"https://github.com/pactflow/pactflow-load-test","last_synced_at":"2025-04-30T03:44:42.338Z","repository":{"id":105899827,"uuid":"281866515","full_name":"pactflow/pactflow-load-test","owner":"pactflow","description":"Sample load test runner for an on-premise installation","archived":false,"fork":false,"pushed_at":"2025-04-21T01:49:41.000Z","size":325,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-30T03:44:38.003Z","etag":null,"topics":["internal-tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pactflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-23T06:10:38.000Z","updated_at":"2025-02-21T00:50:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef413dfb-0f3b-49a7-8275-c00ce227db4a","html_url":"https://github.com/pactflow/pactflow-load-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fpactflow-load-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fpactflow-load-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fpactflow-load-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fpactflow-load-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pactflow","download_url":"https://codeload.github.com/pactflow/pactflow-load-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251638750,"owners_count":21619661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["internal-tool"],"created_at":"2024-12-11T17:08:07.923Z","updated_at":"2025-04-30T03:44:42.317Z","avatar_url":"https://github.com/pactflow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Load Testing a PactFlow On-Premise Installation\n\nA simple load test for PactFlow installations.\n\nThe goals of this test framework are threefold:\n\n1. Create a base, representative load through a pactflow installation, so that you can run resilience, chaos and other tests to understand the potential impact to users\n1. Understand scaling properties - e.g. is it CPU, I/O or network bound - in order to tune autoscaling, metrics and alarms\n1. Understand the limits of the system\n\n## Installation\n\n*Prerequisites*\n* NodeJS v8+\n* npm 5+\n* A running PactFlow system\n\n```\nnpm i\n```\n\n## Precautions\n\nWe know that you'll be careful, but here is our obligatory warning _just in case_ and so we can say _\"we told you so\"_:\n\nIt is not recommended to run this on your production system, or a system that a user depends on. It is potentially destructive and is likely to be disruptive to active users. Really, it's intended for shaking out infrastructure in a non-production environment.\n\n## Structure \u0026 Key Components\n\n* `./fixtures` - test data and environment specific config\n* `./src` - specific scripts for use within the Artillery tests\n* `./setup.yml` - the script to setup the scenario\n* `./baseline.yml` - the main scenario load runner\n* `./teardown.yml` - the script to tear down data from the load test\n\n## Running\n\nThe setup is configurable for multiple environments with the `-e` switch.\n\n### 1. Set the host \u0026 authentication token for the test\n\n* Update the Host (default is `localhost`) `./fixtures/accounts-dev.csv` to the hostname of your PactFlow instance (do not include the protocol here)\n* Get a read/write API token from your running PactFlow instance Bearer token in `./fixtures/accounts-dev.csv`.\n* Set the `environments.dev.target` URL in `./setup.yml`, `teardown.yml` and `./baseline.yml` to your running PactFlow instance.\n\n### 2. Setup base data\n\nThis will pre-seed a number of consumers, providers and contracts into the system.\n\n```\nnpm run setup\n```\n\n### 3. Run the load test\n\n```\nnpm run load\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./docs/artillery-cli-report.png\"\u003e\n\u003c/p\u003e\n\n### 4. Review the report\n\n```\nnpm run report\n```\n\nIt should produce a pretty report that looks something like this:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./docs/artillery-report.png\"\u003e\n\u003c/p\u003e\n\n\n### 5. Teardown/Cleanup\n\nThis will remove all pacticipants and related resources that were created by the test. NOTE that this does not include webhooks.\n\n```\nnpm run teardown\n```\n\n### Adjusting the scenarios\n\nThe scenarios are currently loosely balanced based on the mix that we (PactFlow) see on our cloud platform. You may need to adjust the mix for your specific needs.\n\nThe current scenarios we support:\n\n1. Publishing Pacts\n1. Provider Verification\n1. Creating Webhooks\n1. General API querying\n1. UI interactions\n\nEdit the `flows` section of `baseline.yml` to add/remove scenarios, and adjust any `weights` to get the balance you need.\n\nThe current load test is fairly basic - 10 users arriving per second for 1 minute, each running one of the (weighted) random scenarios. Some scenarios perform multiple HTTP requests.\n\nSee https://artillery.io/ for complete documentation on the tool.\n\n## Cleaning up\n\nTrick question! This is really intended for ephemeral infrastructure or testing out the performance of a new stack.\n\nThe teardown script is a \"best effort\" type thing - any customisations to the script may make cleaning up quite difficult. There is no simple way to cleanup here; tear down and rebuild the stack.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fpactflow-load-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpactflow%2Fpactflow-load-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fpactflow-load-test/lists"}