Add a unit tests and missing flags in etcd help.
Signed-off-by: ishan16696 <ishan.tyagi@sap.com>
This commit is contained in:
parent
2664430d7e
commit
06d7312c73
@ -15,6 +15,7 @@
|
|||||||
package etcdmain
|
package etcdmain
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -24,6 +25,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"go.etcd.io/etcd/embed"
|
"go.etcd.io/etcd/embed"
|
||||||
|
"go.etcd.io/etcd/pkg/flags"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -496,6 +498,21 @@ func TestConfigFileElectionTimeout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFlagsPresentInHelp(t *testing.T) {
|
||||||
|
cfg := newConfig()
|
||||||
|
cfg.cf.flagSet.VisitAll(func(f *flag.Flag) {
|
||||||
|
if _, ok := f.Value.(*flags.IgnoredFlag); ok {
|
||||||
|
// Ignored flags do not need to be in the help
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
flagText := fmt.Sprintf("--%s", f.Name)
|
||||||
|
if !strings.Contains(flagsline, flagText) && !strings.Contains(usageline, flagText) {
|
||||||
|
t.Errorf("Neither flagsline nor usageline in help.go contains flag named %s", flagText)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func mustCreateCfgFile(t *testing.T, b []byte) *os.File {
|
func mustCreateCfgFile(t *testing.T, b []byte) *os.File {
|
||||||
tmpfile, err := ioutil.TempFile("", "servercfg")
|
tmpfile, err := ioutil.TempFile("", "servercfg")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -85,6 +85,8 @@ Member:
|
|||||||
Minimum duration interval that a client should wait before pinging server.
|
Minimum duration interval that a client should wait before pinging server.
|
||||||
--grpc-keepalive-interval '2h'
|
--grpc-keepalive-interval '2h'
|
||||||
Frequency duration of server-to-client ping to check if a connection is alive (0 to disable).
|
Frequency duration of server-to-client ping to check if a connection is alive (0 to disable).
|
||||||
|
--enable-grpc-gateway
|
||||||
|
Enable GRPC gateway.
|
||||||
--grpc-keepalive-timeout '20s'
|
--grpc-keepalive-timeout '20s'
|
||||||
Additional duration of wait before closing a non-responsive connection (0 to disable).
|
Additional duration of wait before closing a non-responsive connection (0 to disable).
|
||||||
|
|
||||||
@ -229,6 +231,8 @@ Experimental feature:
|
|||||||
Unsafe feature:
|
Unsafe feature:
|
||||||
--force-new-cluster 'false'
|
--force-new-cluster 'false'
|
||||||
Force to create a new one-member cluster.
|
Force to create a new one-member cluster.
|
||||||
|
--unsafe-no-fsync 'false'
|
||||||
|
Disables fsync, unsafe, will cause data loss.
|
||||||
|
|
||||||
CAUTIOUS with unsafe flag! It may break the guarantees given by the consensus protocol!
|
CAUTIOUS with unsafe flag! It may break the guarantees given by the consensus protocol!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user