MCPcopy
hub / github.com/etcd-io/etcd / TestNewClientConfigWithSecureCfg

Function TestNewClientConfigWithSecureCfg

client/v3/config_test.go:151–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

149}
150
151func TestNewClientConfigWithSecureCfg(t *testing.T) {
152 tls, err := transport.SelfCert(zap.NewNop(), t.TempDir(), []string{"localhost"}, 1)
153 require.NoError(t, err)
154
155 scfg := &SecureConfig{
156 Cert: tls.CertFile,
157 Key: tls.KeyFile,
158 Cacert: tls.TrustedCAFile,
159 }
160
161 cfg, err := NewClientConfig(&ConfigSpec{
162 Endpoints: []string{"http://192.168.0.13:2379"},
163 DialTimeout: 2 * time.Second,
164 KeepAliveTime: 3 * time.Second,
165 KeepAliveTimeout: 5 * time.Second,
166 Secure: scfg,
167 }, nil)
168 require.NoErrorf(t, err, "Unexpected result client config")
169 if cfg == nil || cfg.TLS == nil {
170 t.Fatalf("Unexpected result client config: %v", err)
171 }
172}
173
174func TestConfigSpecClone(t *testing.T) {
175 cfgSpec := &ConfigSpec{

Callers

nothing calls this directly

Calls 3

NewClientConfigFunction · 0.85
TempDirMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…