{"id":29796436,"url":"https://github.com/icelaterdc/k6-load-test","last_synced_at":"2025-07-28T05:09:58.201Z","repository":{"id":304841641,"uuid":"1020217935","full_name":"icelaterdc/K6-Load-Test","owner":"icelaterdc","description":"A minimal Go HTTP service with configurable k6 load tests.","archived":false,"fork":false,"pushed_at":"2025-07-15T16:12:35.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-16T07:43:17.791Z","etag":null,"topics":["automated-testing","automated-tests","ci-cd","cicd","containerization","continuous-integration","docker","go","golang","health-endpoint","http-api","k6","load-testing","microservice","observability","performance-testing","restful-service","restful-services","sharedarraybuffer","virtual-users"],"latest_commit_sha":null,"homepage":"","language":"Go","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/icelaterdc.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,"zenodo":null}},"created_at":"2025-07-15T14:19:10.000Z","updated_at":"2025-07-15T16:12:39.000Z","dependencies_parsed_at":"2025-07-16T11:55:38.557Z","dependency_job_id":"1e77359b-9a3c-4485-a2f2-86eda03c46c9","html_url":"https://github.com/icelaterdc/K6-Load-Test","commit_stats":null,"previous_names":["icelaterdc/k6-load-test"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/icelaterdc/K6-Load-Test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelaterdc%2FK6-Load-Test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelaterdc%2FK6-Load-Test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelaterdc%2FK6-Load-Test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelaterdc%2FK6-Load-Test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icelaterdc","download_url":"https://codeload.github.com/icelaterdc/K6-Load-Test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icelaterdc%2FK6-Load-Test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267464522,"owners_count":24091505,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automated-testing","automated-tests","ci-cd","cicd","containerization","continuous-integration","docker","go","golang","health-endpoint","http-api","k6","load-testing","microservice","observability","performance-testing","restful-service","restful-services","sharedarraybuffer","virtual-users"],"created_at":"2025-07-28T05:09:57.525Z","updated_at":"2025-07-28T05:09:58.192Z","avatar_url":"https://github.com/icelaterdc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Load Test with Go and k6\n\nA simple project to run HTTP load tests using Go as a wrapper for k6. Configuration (VUs, target URL, duration) is read from a `config.json` file so you can adjust parameters without changing the code.\n\n---\n\n## ⚠️ Warning:\n\nThis project is a load testing software designed to measure the resilience of websites. We are not responsible if it is used outside of legal and ethical frameworks!\n\n---\n\n### Features\n\n* Read test parameters (VUs, duration, target URL) from JSON config\n* Go wrapper injects environment variables into k6 script\n* Simple Go executable launches k6 load test\n* No extra dependencies beyond Go and k6\n\n---\n\n### Prerequisites\n\n* [Go 1.21+](https://golang.org/doc/install)\n* [k6](https://k6.io/) installed globally\n\n---\n\n### Project Structure\n\n```\nK6-Load-Test/\n├─ go.mod         # Go module file\n├─ config.json    # Test configuration file\n├─ main.go        # Go wrapper for k6\n└─ loadtest.js    # k6 script for HTTP requests\n```\n\n---\n\n### Configuration\n\nEdit `config.json` to set your test parameters:\n\n```json\n{\n  \"vus\": 1000,         // Number of virtual users\n  \"duration\": \"60s\",   // Total duration (e.g. \"30s\", \"2m\", \"1h\")\n  \"target_url\": \"https://example.com\" // Endpoint to test\n}\n```\n\n**Note:** The `target_url` value is read by the Go program and passed to the k6 script via an environment variable (`TARGET_URL`). The k6 script itself does not read `config.json` directly.\n\n---\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/icelaterdc/K6-Load-Test.git\n   cd K6-Load-Test\n   ```\n2. Ensure Go modules are initialized:\n\n   ```bash\n   go mod tidy\n   ```\n3. Verify k6 is installed:\n\n   ```bash\n   k6 version\n   ```\n\n---\n\n### Usage\n\nRun the Go application, which will:\n\n1. Read `config.json` for VUs, duration, and target URL.\n2. Set the `TARGET_URL` environment variable for k6.\n3. Launch the k6 script with the provided parameters.\n\n```bash\ngo run main.go\n```\n\nYou will see k6 output, including metrics like requests per second, response times, and checks.\n\n---\n\n### How It Works\n\n1. **Read Config**: `main.go` reads `config.json` and parses it into a Go struct.\n2. **Build Command**: Constructs the command:\n\n   ```bash\n   k6 run --vus \u003cVUs\u003e --duration \u003cDuration\u003e loadtest.js\n   ```\n3. **Inject Env Var**: Sets `TARGET_URL` in the environment for the k6 process, using the value from `config.json`.\n4. **Execute**: Runs k6 and streams the results to the console.\n\nIn `loadtest.js`, k6 accesses the URL via `__ENV.TARGET_URL`:\n\n```js\nimport http from 'k6/http';\nimport { check, sleep } from 'k6';\n\nexport default function () {\n  const res = http.get(__ENV.TARGET_URL);\n  check(res, {\n    'status is 200': (r) =\u003e r.status === 200,\n  });\n  sleep(1);\n}\n```\n\n---\n\n### Contributing\n\nContributions are welcome! Feel free to:\n\n* Open an issue for bugs or feature requests\n* Submit pull requests with improvements\n\nPlease follow standard GitHub flow:\n\n1. Fork the repo\n2. Create a feature branch\n3. Commit your changes\n4. Open a pull request\n\n---\n\n### License\n\nThis project is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelaterdc%2Fk6-load-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficelaterdc%2Fk6-load-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficelaterdc%2Fk6-load-test/lists"}