{"id":20540444,"url":"https://github.com/jahaja/ltt","last_synced_at":"2025-03-06T04:17:48.114Z","repository":{"id":137711798,"uuid":"296109783","full_name":"Jahaja/ltt","owner":"Jahaja","description":"User-Simulation Load Testing Tool","archived":false,"fork":false,"pushed_at":"2020-09-20T20:46:49.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-16T14:52:43.453Z","etag":null,"topics":["go","golang","http","load-testing","user-simulator"],"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/Jahaja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-09-16T18:03:10.000Z","updated_at":"2020-09-20T20:46:51.000Z","dependencies_parsed_at":"2024-06-21T13:08:27.060Z","dependency_job_id":"f7e648cb-5b50-4def-b83b-9531ed379749","html_url":"https://github.com/Jahaja/ltt","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jahaja%2Fltt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jahaja%2Fltt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jahaja%2Fltt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jahaja%2Fltt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jahaja","download_url":"https://codeload.github.com/Jahaja/ltt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242144578,"owners_count":20078970,"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":["go","golang","http","load-testing","user-simulator"],"created_at":"2024-11-16T01:15:23.617Z","updated_at":"2025-03-06T04:17:48.082Z","avatar_url":"https://github.com/Jahaja.png","language":"Go","readme":"# Load Testing Tool\n\nLargely based on the Python project Locust.\n\nSets up an HTTP API that provides the load test data in JSON.\n\n# Usage\n\n### Example\n```go\nfunc main() {\n\tconf := ltt.NewConfigFromFlags()\n\tlt := ltt.NewLoadTest(conf)\n  \n        // Set up auth as an entry task for each simulated user\n\tentryTask := ltt.NewEntryTask(\"auth\", func(ctx context.Context) error {\n\t\tuser := ltt.UserFromContext(ctx)\n\t\tclient := ltt.NewHTTPClient(ctx, \"http://localhost:4000\")\n\n\t\tctx = ltt.NewHTTPClientContext(ctx, client)\n\t\tuser.SetContext(ctx)\n\n\t\tdata, _ := json.Marshal(map[string]string{\n\t\t\t\"username\": \"\",\n\t\t\t\"password\": \"\",\n\t\t})\n\n\t\tresp, err := client.Post(\"/v1/auth\", data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tobj := make(map[string]string)\n\t\terr = resp.JSON(\u0026obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tclient.Headers.Set(\"Authorization\", \"Bearer \"+obj[\"token\"])\n\t\treturn nil\n\t}, ltt.TaskOptions{})\n  \n        // Add a profile section and a few sub tasks.\n        // The next subtask to run is chosen by random according to their weight after\n        // each task run + sleep (which simulates user usage/reading time)\n\tentryTask.AddSection(\"profile\", func(t *ltt.Task) {\n\t\tt.AddSubTask(\"view\", func(ctx context.Context) error {\n\t\t\tclient := ltt.HTTPClientFromContext(ctx)\n\t\t\t_, err := client.Get(\"/v1/me\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}, ltt.TaskOptions{Weight: 10})\n\n\t\tt.AddSubTask(\"edit\", func(ctx context.Context) error {\n\t\t\tclient := ltt.HTTPClientFromContext(ctx)\n\t\t\t_, err := client.Patch(\"/profile\", nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}, ltt.TaskOptions{Weight: 1})\n\n\t}, ltt.TaskOptions{Weight: 1})\n\n\tlt.Run(entryTask)\n}\n```\n\n### CLI Options\n```\nUsage of ltt:\n  -api-host string\n        REST API port to bind to.\n  -api-port int\n        REST API port to bind to. (default 4141)\n  -log-prefix string\n        Logging prefix\n  -max-sleep-time int\n        Maximum sleep time between a user's tasks in seconds (default 10)\n  -min-sleep-time int\n        Minimum sleep time between a user's tasks in seconds (default 1)\n  -num-spawn-per-sec int\n        Number of user to spawn per second (default 1)\n  -num-users int\n        Number of users to spawn (default 5)\n  -request-timeout int\n        Request timeout in seconds (default 5)\n  -spawn-on-startup\n        If true, spawning will begin on startup\n  -verbose\n        Verbose logging\n```\n\n## User-Interfaces\n\nTerminal-UI\nhttps://github.com/Jahaja/ltt-tui\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahaja%2Fltt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjahaja%2Fltt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjahaja%2Fltt/lists"}