package testserver
import "k8s.io/apiserver/pkg/storage/etcd3/testserver"
Index ¶
- func NewTestConfig(t *testing.T) *embed.Config
- func RunEtcd(t *testing.T, cfg *embed.Config) *clientv3.Client
Functions ¶
func NewTestConfig ¶
NewTestConfig returns a configuration for an embedded etcd server. The configuration is based on embed.NewConfig(), with the following adjustments:
- sets UnsafeNoFsync = true to improve test performance (only reasonable in a test-only single-member server we never intend to restart or keep data from)
- uses free ports for client and peer listeners
- cleans up the data directory on test termination
- silences server logs other than errors
func RunEtcd ¶
RunEtcd starts an embedded etcd server with the provided config (or NewTestConfig(t) if nil), and returns a client connected to the server. The server is terminated when the test ends.
Source Files ¶
test_server.go
- Version
- v0.23.13
- Published
- Oct 13, 2022
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 2 minutes ago –
Tools for package owners.