mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Backport adding unit test for socket options.
Co-authored-by: Shawn Gerrard <shawn.gerrard@gmail.com> Signed-off-by: James Blair <mail@jamesblair.net>
This commit is contained in:
parent
2a7bffc63e
commit
164175dfe3
@ -48,6 +48,7 @@ func TestConfigFileOtherFields(t *testing.T) {
|
|||||||
Logger string `json:"logger"`
|
Logger string `json:"logger"`
|
||||||
LogOutputs []string `json:"log-outputs"`
|
LogOutputs []string `json:"log-outputs"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
|
SocketOpts transport.SocketOpts `json:"socket-options"`
|
||||||
}{
|
}{
|
||||||
ctls,
|
ctls,
|
||||||
ptls,
|
ptls,
|
||||||
@ -55,6 +56,9 @@ func TestConfigFileOtherFields(t *testing.T) {
|
|||||||
"zap",
|
"zap",
|
||||||
[]string{"/dev/null"},
|
[]string{"/dev/null"},
|
||||||
false,
|
false,
|
||||||
|
transport.SocketOpts{
|
||||||
|
ReusePort: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := yaml.Marshal(&yc)
|
b, err := yaml.Marshal(&yc)
|
||||||
@ -70,16 +74,18 @@ func TestConfigFileOtherFields(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.ForceNewCluster {
|
|
||||||
t.Errorf("ForceNewCluster = %v, want %v", cfg.ForceNewCluster, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !ctls.equals(&cfg.ClientTLSInfo) {
|
if !ctls.equals(&cfg.ClientTLSInfo) {
|
||||||
t.Errorf("ClientTLS = %v, want %v", cfg.ClientTLSInfo, ctls)
|
t.Errorf("ClientTLS = %v, want %v", cfg.ClientTLSInfo, ctls)
|
||||||
}
|
}
|
||||||
if !ptls.equals(&cfg.PeerTLSInfo) {
|
if !ptls.equals(&cfg.PeerTLSInfo) {
|
||||||
t.Errorf("PeerTLS = %v, want %v", cfg.PeerTLSInfo, ptls)
|
t.Errorf("PeerTLS = %v, want %v", cfg.PeerTLSInfo, ptls)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, true, cfg.ForceNewCluster, "ForceNewCluster does not match")
|
||||||
|
|
||||||
|
assert.Equal(t, true, cfg.SocketOpts.ReusePort, "ReusePort does not match")
|
||||||
|
|
||||||
|
assert.Equal(t, false, cfg.SocketOpts.ReuseAddress, "ReuseAddress does not match")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestUpdateDefaultClusterFromName ensures that etcd can start with 'etcd --name=abc'.
|
// TestUpdateDefaultClusterFromName ensures that etcd can start with 'etcd --name=abc'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user