Skip to content

Commit 8240876

Browse files
authored
Merge pull request #108 from Integration-Automation/dev
feat: expand framework across protocols, reliability, integrations, auth + refresh docs
2 parents f942664 + 7cf7901 commit 8240876

150 files changed

Lines changed: 17241 additions & 1185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-hooks.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- id: loaddensity-lint
2+
name: LoadDensity action JSON linter
3+
description: "Lint LoadDensity action JSON files with LD_lint_action_file"
4+
entry: python -m je_load_density.tools.lint_files
5+
language: python
6+
files: '\.(json|action\.json)$'
7+
pass_filenames: true
8+
require_serial: false

README.md

Lines changed: 477 additions & 57 deletions
Large diffs are not rendered by default.

README/README_zh-CN.md

Lines changed: 436 additions & 335 deletions
Large diffs are not rendered by default.

README/README_zh-TW.md

Lines changed: 606 additions & 272 deletions
Large diffs are not rendered by default.

action.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: "LoadDensity Action"
2+
description: "Run a LoadDensity action JSON and surface failures as GitHub annotations."
3+
author: "JE-Chen"
4+
branding:
5+
icon: "activity"
6+
color: "purple"
7+
8+
inputs:
9+
python-version:
10+
description: "Python version to install"
11+
required: false
12+
default: "3.11"
13+
action-file:
14+
description: "Path to the LoadDensity action JSON to execute"
15+
required: true
16+
extras:
17+
description: "Optional extras to install (e.g. 'metrics,websocket')"
18+
required: false
19+
default: ""
20+
fail-on-error:
21+
description: "Fail the job when LoadDensity emits any failure record"
22+
required: false
23+
default: "true"
24+
pip-install-extra:
25+
description: "Extra pip install args (e.g. matplotlib)"
26+
required: false
27+
default: ""
28+
29+
runs:
30+
using: "composite"
31+
steps:
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: ${{ inputs.python-version }}
36+
37+
- name: Install LoadDensity
38+
shell: bash
39+
env:
40+
LD_EXTRAS: ${{ inputs.extras }}
41+
LD_PIP_EXTRA: ${{ inputs.pip-install-extra }}
42+
run: |
43+
python -m pip install --upgrade pip
44+
if [ -n "$LD_EXTRAS" ]; then
45+
pip install "je_load_density[${LD_EXTRAS}]"
46+
else
47+
pip install je_load_density
48+
fi
49+
if [ -n "$LD_PIP_EXTRA" ]; then
50+
pip install $LD_PIP_EXTRA
51+
fi
52+
53+
- name: Lint action JSON
54+
shell: bash
55+
env:
56+
LD_ACTION_FILE: ${{ inputs.action-file }}
57+
run: |
58+
python - <<'PY'
59+
import os, sys
60+
from je_load_density import lint_action_file
61+
path = os.environ["LD_ACTION_FILE"]
62+
findings = lint_action_file(path)
63+
for finding in findings:
64+
print(f"::{finding['severity']} file={path}::{finding['message']}")
65+
sys.exit(1 if any(f["severity"] == "error" for f in findings) else 0)
66+
PY
67+
68+
- name: Run LoadDensity
69+
shell: bash
70+
env:
71+
LD_ACTION_FILE: ${{ inputs.action-file }}
72+
run: python -m je_load_density run "$LD_ACTION_FILE"
73+
74+
- name: Emit GitHub annotations
75+
shell: bash
76+
env:
77+
LD_FAIL_ON_ERROR: ${{ inputs.fail-on-error }}
78+
run: |
79+
python - <<'PY'
80+
import os, sys
81+
from je_load_density import emit_github_annotations
82+
count = emit_github_annotations(title="LoadDensity")
83+
fail = os.environ.get("LD_FAIL_ON_ERROR", "true") == "true"
84+
sys.exit(1 if (count > 0 and fail) else 0)
85+
PY

docker/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# LoadDensity local lab
2+
3+
A docker-compose file that brings up every target the examples need:
4+
5+
| Service | Port | Purpose |
6+
|---|---|---|
7+
| `httpbin` | `:8080` | Generic HTTP echo server. |
8+
| `mosquitto` | `:1883` | MQTT broker for `examples/mqtt_pubsub.py`. |
9+
| `redis` | `:6379` | Redis for `examples/redis_load.json`. |
10+
| `kafka` | `:9092` | Single-broker Kafka cluster (KRaft mode). |
11+
| `prometheus` | `:9090` | Scrapes the LoadDensity Prometheus exporter on the host. |
12+
13+
## Quick start
14+
15+
```bash
16+
docker compose -f docker/docker-compose.yml up -d
17+
# … run examples …
18+
docker compose -f docker/docker-compose.yml down -v
19+
```
20+
21+
## Notes
22+
23+
* The Prometheus job scrapes `host.docker.internal:9646`, which is the
24+
default port of `start_prometheus_exporter`. On Linux without
25+
`host.docker.internal`, point the job at your host IP instead.
26+
* Kafka uses KRaft (no Zookeeper) and exposes a single broker — good
27+
enough for examples, not for production load.
28+
* `mosquitto.conf` allows anonymous connections; tighten before
29+
exposing the broker.

docker/docker-compose.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Local lab stack for running the LoadDensity examples end-to-end.
2+
# Start with: docker compose -f docker/docker-compose.yml up -d
3+
4+
services:
5+
httpbin:
6+
image: kennethreitz/httpbin:latest
7+
container_name: ld-httpbin
8+
ports:
9+
- "8080:80"
10+
11+
mosquitto:
12+
image: eclipse-mosquitto:2
13+
container_name: ld-mosquitto
14+
ports:
15+
- "1883:1883"
16+
volumes:
17+
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
18+
19+
redis:
20+
image: redis:7-alpine
21+
container_name: ld-redis
22+
ports:
23+
- "6379:6379"
24+
25+
kafka:
26+
image: bitnami/kafka:3.7
27+
container_name: ld-kafka
28+
ports:
29+
- "9092:9092"
30+
environment:
31+
- KAFKA_CFG_NODE_ID=0
32+
- KAFKA_CFG_PROCESS_ROLES=controller,broker
33+
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@localhost:9093
34+
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
35+
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
36+
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
37+
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
38+
- ALLOW_PLAINTEXT_LISTENER=yes
39+
40+
prometheus:
41+
image: prom/prometheus:latest
42+
container_name: ld-prometheus
43+
ports:
44+
- "9090:9090"
45+
volumes:
46+
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
47+
extra_hosts:
48+
- "host.docker.internal:host-gateway"

docker/mosquitto.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
listener 1883
2+
allow_anonymous true
3+
persistence false

docker/prometheus.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
global:
2+
scrape_interval: 5s
3+
evaluation_interval: 5s
4+
5+
scrape_configs:
6+
- job_name: "loaddensity"
7+
static_configs:
8+
- targets: ["host.docker.internal:9646"]

docs/source/En/doc/api_reference/api_reference.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ The auto-generated Python reference is regenerated by Sphinx
1212
je_load_density.utils.executor.action_executor
1313
je_load_density.utils.parameterization.parameter_resolver
1414
je_load_density.utils.recording.har_importer
15+
je_load_density.utils.recording.postman_importer
16+
je_load_density.utils.recording.openapi_importer
17+
je_load_density.utils.recording.curl_importer
18+
je_load_density.utils.recording.k6_importer
19+
je_load_density.utils.recording.jmeter_importer
1520
je_load_density.utils.metrics.prometheus_exporter
1621
je_load_density.utils.metrics.influxdb_sink
1722
je_load_density.utils.metrics.opentelemetry_exporter
23+
je_load_density.utils.metrics.statsd_sink
1824
je_load_density.utils.test_record.test_record_class
1925
je_load_density.utils.test_record.sqlite_persistence
2026
je_load_density.utils.generate_report.generate_html_report
@@ -23,15 +29,41 @@ The auto-generated Python reference is regenerated by Sphinx
2329
je_load_density.utils.generate_report.generate_csv_report
2430
je_load_density.utils.generate_report.generate_junit_report
2531
je_load_density.utils.generate_report.generate_summary_report
32+
je_load_density.utils.generate_report.generate_chart_report
2633
je_load_density.utils.socket_server.load_density_socket_server
34+
je_load_density.utils.sla.sla_gates
35+
je_load_density.utils.regression.diff
36+
je_load_density.utils.load_shapes.shapes
37+
je_load_density.utils.throttle.rps_throttle
38+
je_load_density.utils.linter.action_linter
39+
je_load_density.utils.schema.action_schema
40+
je_load_density.utils.ci_annotations.github_actions
41+
je_load_density.utils.graphql.graphql_task
42+
je_load_density.utils.reliability.adaptive_retry
43+
je_load_density.utils.reliability.failure_budget
44+
je_load_density.utils.reliability.network_conditioner
45+
je_load_density.utils.reliability.process_supervisor
46+
je_load_density.utils.dashboard.live_dashboard
47+
je_load_density.utils.notifier.slack
48+
je_load_density.utils.notifier.teams
49+
je_load_density.utils.auth.oauth2
50+
je_load_density.utils.auth.jwt_signer
51+
je_load_density.utils.auth.aws_sigv4
2752
je_load_density.wrapper.create_locust_env.create_locust_env
2853
je_load_density.wrapper.start_wrapper.start_test
2954
je_load_density.wrapper.user_template.request_executor
3055
je_load_density.wrapper.user_template.scenario_runner
3156
je_load_density.wrapper.user_template.http_user_template
3257
je_load_density.wrapper.user_template.fast_http_user_template
58+
je_load_density.wrapper.user_template.async_http_user_template
3359
je_load_density.wrapper.user_template.websocket_user_template
60+
je_load_density.wrapper.user_template.sse_user_template
3461
je_load_density.wrapper.user_template.grpc_user_template
3562
je_load_density.wrapper.user_template.mqtt_user_template
63+
je_load_density.wrapper.user_template.kafka_user_template
3664
je_load_density.wrapper.user_template.socket_user_template
65+
je_load_density.wrapper.user_template.sql_user_template
66+
je_load_density.wrapper.user_template.redis_user_template
67+
je_load_density.wrapper.user_template.mongo_user_template
68+
je_load_density.action_lsp.server
3769
je_load_density.mcp_server.server

0 commit comments

Comments
 (0)