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:46:42 +05:30 committed by ishan16696
parent af1fb6f31f
commit 0ac8e50a1a
2 changed files with 37 additions and 1 deletions

View File

@ -15,6 +15,7 @@
package etcdmain
import (
"flag"
"fmt"
"io/ioutil"
"net/url"
@ -23,6 +24,7 @@ import (
"strings"
"testing"
"go.etcd.io/etcd/pkg/v3/flags"
"go.etcd.io/etcd/server/v3/embed"
"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

@ -20,6 +20,7 @@ import (
cconfig "go.etcd.io/etcd/server/v3/config"
"go.etcd.io/etcd/server/v3/embed"
"go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp"
"golang.org/x/crypto/bcrypt"
)
@ -84,6 +85,8 @@ Member:
Maximum client request size in bytes the server will accept.
--max-concurrent-streams 'math.MaxUint32'
Maximum concurrent streams that each client can open at a time.
--enable-grpc-gateway
Enable GRPC gateway.
--grpc-keepalive-min-time '5s'
Minimum duration interval that a client should wait before pinging server.
--grpc-keepalive-interval '2h'
@ -93,7 +96,11 @@ Member:
--socket-reuse-port 'false'
Enable to set socket option SO_REUSEPORT on listeners allowing rebinding of a port already in use.
--socket-reuse-address 'false'
Enable to set socket option SO_REUSEADDR on listeners allowing binding to an address in TIME_WAIT state.
Enable to set socket option SO_REUSEADDR on listeners allowing binding to an address in TIME_WAIT state.
--raft-read-timeout '` + rafthttp.DefaultConnReadTimeout.String() + `'
Read timeout set on each rafthttp connection
--raft-write-timeout '` + rafthttp.DefaultConnWriteTimeout.String() + `'
Write timeout set on each rafthttp connection
Clustering:
--initial-advertise-peer-urls 'http://localhost:2380'
@ -145,6 +152,10 @@ Security:
Path to the client server TLS key file.
--client-cert-auth 'false'
Enable client cert authentication.
--client-cert-file ''
Path to an explicit peer client TLS cert file otherwise cert file will be used when client auth is required.
--client-key-file ''
Path to an explicit peer client TLS key file otherwise key file will be used when client auth is required.
--client-crl-file ''
Path to the client certificate revocation list file.
--client-cert-allowed-hostname ''
@ -167,6 +178,10 @@ Security:
Allowed TLS hostname for inter peer authentication.
--peer-auto-tls 'false'
Peer TLS using self-generated certificates if --peer-key-file and --peer-cert-file are not provided.
--peer-client-cert-file ''
Path to an explicit peer client TLS cert file otherwise peer cert file will be used when client auth is required.
--peer-client-key-file ''
Path to an explicit peer client TLS key file otherwise peer key file will be used when client auth is required.
--self-signed-cert-validity '1'
The validity period of the client and peer certificates that are automatically generated by etcd when you specify ClientAutoTLS and PeerAutoTLS, the unit is year, and the default is 1.
--peer-crl-file ''
@ -257,6 +272,10 @@ Experimental feature:
Skip verification of SAN field in client certificate for peer connections.
--experimental-watch-progress-notify-interval '10m'
Duration of periodical watch progress notification.
--experimental-downgrade-check-time
Duration of time between two downgrade status checks.
--experimental-memory-mlock
Enable to enforce etcd pages (in particular bbolt) to stay in RAM.
--experimental-warning-apply-duration '100ms'
Warning is generated if requests take more than this duration.
--experimental-txn-mode-write-with-shared-buffer 'true'