Add a unit tests and missing flags in etcd help.

Signed-off-by: ishan16696 <ishan.tyagi@sap.com>
This commit is contained in:
Ishan Tyagi 2024-01-05 14:58:27 +05:30 committed by ishan16696
parent 2664430d7e
commit 06d7312c73
2 changed files with 21 additions and 0 deletions

View File

@ -15,6 +15,7 @@
package etcdmain
import (
"flag"
"fmt"
"io/ioutil"
"net/url"
@ -24,6 +25,7 @@ import (
"testing"
"go.etcd.io/etcd/embed"
"go.etcd.io/etcd/pkg/flags"
"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 {
tmpfile, err := ioutil.TempFile("", "servercfg")
if err != nil {

View File

@ -85,6 +85,8 @@ Member:
Minimum duration interval that a client should wait before pinging server.
--grpc-keepalive-interval '2h'
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'
Additional duration of wait before closing a non-responsive connection (0 to disable).
@ -229,6 +231,8 @@ Experimental feature:
Unsafe feature:
--force-new-cluster 'false'
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!