mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-04-11 21:53:45 +00:00
KV Store Example
This example runs a small replicated key-value store.
The usual scenario writes keys through one node and checks that the other nodes eventually return the same values.
How TF runs this
Each example follows the same pattern:
- TF starts a small deployment of kvstore nodes
- a workload writes keys through one node
- an expectation keeps reading from all nodes until they agree on the values
Scenarios
basic_convergenceruns the convergence check locallycompose_convergenceruns the same check in Docker Composek8s_convergenceruns it on Kubernetesk8s_manual_convergencestarts the nodes through the k8s manual cluster API, restarts one node, and checks convergence again
API
Each node exposes:
PUT /kv/:keyto write a valueGET /kv/:keyto read a valueGET /internal/snapshotto read the local replicated state
Run locally
cargo run -p kvstore-examples --bin basic_convergence
Run with Docker Compose
cargo run -p kvstore-examples --bin compose_convergence
Set KVSTORE_IMAGE to override the default compose image tag.
Run with Kubernetes
docker build -t kvstore-node:local -f examples/kvstore/Dockerfile .
cargo run -p kvstore-examples --bin k8s_convergence
Prerequisites:
kubectlconfigured with a reachable clusterhelminstalled
Optional image override:
KVSTORE_K8S_IMAGE(falls back toKVSTORE_IMAGE, thenkvstore-node:local)
Run with Kubernetes manual cluster
docker build -t kvstore-node:local -f examples/kvstore/Dockerfile .
cargo run -p kvstore-examples --bin k8s_manual_convergence