package testserver
import "k8s.io/apiserver/pkg/storage/etcd3/testserver"
Index ¶
- func NewTestConfig(t testing.TB) *embed.Config
- func RunEtcd(t testing.TB, cfg *embed.Config) *kubernetes.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.33.1 (latest)
- Published
- May 15, 2025
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 16 hours ago –
Tools for package owners.