{"id":13835925,"url":"https://github.com/pingcap/tipocket","last_synced_at":"2025-12-30T06:04:05.315Z","repository":{"id":37432077,"uuid":"226638340","full_name":"pingcap/tipocket","owner":"pingcap","description":"A toolkit for testing TiDB","archived":true,"fork":false,"pushed_at":"2023-02-25T03:21:49.000Z","size":19818,"stargazers_count":140,"open_issues_count":27,"forks_count":72,"subscribers_count":91,"default_branch":"master","last_synced_at":"2025-04-09T06:33:18.343Z","etag":null,"topics":["chaos","chaos-mesh","consistency","elle","golang","isolation","sqlsmith"],"latest_commit_sha":null,"homepage":"https://github.com/pingcap/tipocket","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pingcap.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":"2019-12-08T08:43:00.000Z","updated_at":"2025-04-08T09:51:56.000Z","dependencies_parsed_at":"2024-06-18T14:39:21.029Z","dependency_job_id":"3ddf7746-24d0-4dce-9e43-ee1c0c0bc2ca","html_url":"https://github.com/pingcap/tipocket","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pingcap/tipocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Ftipocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Ftipocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Ftipocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Ftipocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pingcap","download_url":"https://codeload.github.com/pingcap/tipocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Ftipocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270479710,"owners_count":24590975,"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-08-14T02:00:10.309Z","response_time":75,"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":["chaos","chaos-mesh","consistency","elle","golang","isolation","sqlsmith"],"created_at":"2024-08-04T15:00:23.883Z","updated_at":"2025-12-15T03:48:41.906Z","avatar_url":"https://github.com/pingcap.png","language":"Go","readme":"\u003cimg src=\"static/logo.png\" alt=\"TiPocket\" width=\"300\"/\u003e\n\nTiPocket is a testing toolkit designed to test TiDB, it encapsulates some testing tools which are also suitable for testing other databases.\n\nTiPocket is inspired by [jepsen-io/jepsen](https://github.com/jepsen-io/jepsen), a famous library on the distributed system field. TiPocket focuses on stability testing on TiDB, it uses [chaos-mesh](https://github.com/pingcap/chaos-mesh) to inject all-round kinds of nemesis on a TiDB cluster.\n\n## Requirements\n\n* [TiDB Operator](https://github.com/pingcap/tidb-operator) \u003e= v1.1.9\n\n* [Chaos Mesh](https://github.com/pingcap/chaos-mesh) \u003e= v1.1.0\n\n## Toolkit\n\n* [go-sqlsmith](https://github.com/chaos-mesh/go-sqlsmith): go-sqlsmith is our Go implementation of sqlsmith, it's a fuzz-testing tool which can generate random MySQL-dialect SQL queries.\n* [go-elle](https://github.com/pingcap/tipocket/tree/master/pkg/elle): Our Go port version of jepsen-io/elle, a general transactional consistency checker for black-box databases.\n\n## Nemesis\n\n* random_kill, all_kill, minor_kill, major_kill, kill_tikv_1node_5min, kill_pd_leader_5min: As their name implies, these nemeses inject unavailable in a specified period of time.\n* short_kill_tikv_1node, short_kill_pd_leader: Kill selected container, used to inject short duration of unavailable fault.\n* partition_one: Isolate single nodes\n* scaling: Scale up/down TiDB/PD/TiKV nodes randomly\n* shuffle-leader-scheduler/shuffle-region-scheduler/random-merge-scheduler: Just as there name implies\n* ~~delay_tikv, delay_pd, errno_tikv, errno_pd, mixed_tikv, mixed_pd: Inject IO-related fault.~~\n* small_skews, subcritical_skews, critical_skews, big_skews, huge_skews: Clock skew, small_skews ~100ms, subcritical_skews ~200ms, critical_skews ~250ms, big_skews ~500ms and huge_skews ~5s.\n\n## Create a new case\n\nrun `make init c=$case`, for example:\n\n```sh\n$ make init c=demo\nGO15VENDOREXPERIMENT=\"1\" CGO_ENABLED=1 GOOS= GOARCH=amd64 GO111MODULE=on go build -ldflags '-s -w -X \"github.com/pingcap/tipocket/pkg/test-infra/fixture.BuildTS=2021-02-05 07:13:54\" -X \"github.com/pingcap/tipocket/pkg/test-infra/fixture.BuildHash=a70411f45605864da28a5000aff72a226a1ab27f\"'  -o bin/tipocket cmd/tipocket/*.go\nbin/tipocket init -c demo\ncreate a new case `demo`: testcase/demo\n```\n\n## Debug and Run\n\nIf you have a K8s cluster, you can use the below commands to deploy and run the case on a TiDB cluster.\n\n### On a K8s cluster\n\n\n#### Access directly\n\n```sh\nmake build\nexport KUBECONFIG=${YOUR_KUBECONFIG_PATH}\n\n# direct connect\nbin/${testcase} -namespace=${ns} -hub=docker.io -image-version=nightly -storage-class=local-path\n```\n\nThis method can't resolve the k8s cluster network accessing and DNS resolution issues, but it's useful for most cases.\n\n#### Access by a proxy on k8s cluster\n\n```bash\nexport KUBECONFIG=${YOUR_KUBECONFIG_PATH}\nkubectl apply -f hacks/debug/k8s-proxy.yaml -n ${ns}\nbin/${testcase} -mysql-proxy=socks5://${a_node_ip}:30080 -namespace=${ns} -hub=docker.io -image-version=nightly -storage-class=local-path\n```\n\nThis method overcomes the k8s cluster network accessing problem, but one flaw is retained: DNS resolution, so proxychains-ng is recommended here (if you don't mind to install it: `brew install proxychains-ng`).\n\n```bash\nexport KUBECONFIG=${YOUR_KUBECONFIG_PATH}\nkubectl apply -f hacks/debug/k8s-proxy.yaml -n ${ns}\n# edit hacks/debug/proxychains.conf, replace REPLACE_ME_WITH_REAL_NODE_IP with a k8s node ip,\n# you can connect to the k8s administrator to get a k8s node ip\nproxychains4 -f hacks/debug/proxychains.conf bin/${testcase} -mysql-proxy=socks5://${a_node_ip}:30080 -namespace=${ns} -hub=docker.io -image-version=nightly -storage-class=local-path\n```\n\n### On the local environment\n\nAnother convenient way we recommend you is using tiup to deploy a cluster on local and use it to debug cases.\n\n* Start a TiDB cluster\n\n```sh\ntiup playground --kv 3\n```\n\n* Specify that cluster address through `-tidb-server` `-tikv-server` and `-pd-server`\n\n```bash\nbin/${testcase} -tidb-server 127.0.0.1:4000 \n```\n\n* If a cluster has many service addresses, you can pass a flag multiple times\n\n```bash\nbin/${testcase} -tikv-server 127.0.0.1:20160 -tikv-server 127.0.0.1:20161\n```\n\n## Workloads\n\nTiPocket includes some consistency, isolation and other kinds of tests\n\n### Consistency\n\n* **bank** transfers between rows of a shared table\n* **pbank** check bank accounts using a linearizability checker [porcupine](https://github.com/anishathalye/porcupine)\n* **vbank** like bank but cover more TiKV features\n* **ledger** yet another bank test\n* **rawkv-linearizability** rawkv linearizability checker\n* **tpcc** use [go-tpc](https://github.com/pingcap/go-tpc) testing consistency\n\n### Isolation\n\n* **append** checks for dependency cycles in transactions using Elle\n* **register** checks for write-read dependency cycles over read-write registers using Elle\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpingcap%2Ftipocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpingcap%2Ftipocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpingcap%2Ftipocket/lists"}