Go tests in this directory analyze the usage of Etcd API based on collected traces from a Kubernetes cluster. They output information on:
This information can be used to track the coverage of k8s-etcd contract.
At first we will manually set up the cluster, run e2e tests, download traces and then execute the test.
# Used for patches, building kind nodes, and running e2e tests. export KUBERNETES_REPO="$(go env GOPATH)/src/k8s.io/kubernetes" # Used when creating kind cluster and running e2e tests. export KUBECONFIG="${KUBERNETES_REPO}/kind-with-tracing-config"
Set up KIND cluster, exercise Kubernetes API, export traces to Jaeger and then download them:
make k8s-coverage
Run Go test
go test -v -timeout 60s go.etcd.io/etcd/tests/v3/robustness/coverage
Clean up the environment
kind delete cluster --name kind-with-external-etcd docker network rm kind-with-external-etcd
Run Jaeger container:
docker run --rm --name jaeger \ -p 16686:16686 \ -p 4317:4317 \ jaegertracing/jaeger:2.6.0 --set=extensions.jaeger_storage.backends.some_storage.memory.max_traces=20000000
Run robustness tests. For example:
env \ TRACING_SERVER_ADDR=localhost:4317 \ GO_TEST_FLAGS='--timeout 10m --count=1 -v --run "^TestRobustness.*/Kubernetes.*"' \ make test-robustness
Download traces and put them into tests/robustness/coverage/testdata directory in Etcd git repository:
curl -v --get --retry 10 --retry-connrefused -o testdata/demo_traces.json \ -H "Content-Type: application/json" \ --data-urlencode "query.start_time_min=$(date --date="5 days ago" -Ins)" \ --data-urlencode "query.start_time_max=$(date -Ins)" \ --data-urlencode "query.service_name=etcd" \ "http://localhost:16686/api/v3/traces"
Run Go test
go test -v -timeout 60s go.etcd.io/etcd/tests/v3/robustness/coverage
It will show the coverage of Kubernetes-Etcd surface by robustness tests.:w
Work on improving these tests is tracked in #20182 and periodic runs in #20642.