mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #17201 from ishan16696/backport-PR16465
[3.5]Add a unit tests and missing flags in etcd help.
This commit is contained in:
commit
8d88e437d1
@ -15,6 +15,7 @@
|
|||||||
package etcdmain
|
package etcdmain
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -23,6 +24,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"go.etcd.io/etcd/pkg/v3/flags"
|
||||||
"go.etcd.io/etcd/server/v3/embed"
|
"go.etcd.io/etcd/server/v3/embed"
|
||||||
"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 {
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
cconfig "go.etcd.io/etcd/server/v3/config"
|
cconfig "go.etcd.io/etcd/server/v3/config"
|
||||||
"go.etcd.io/etcd/server/v3/embed"
|
"go.etcd.io/etcd/server/v3/embed"
|
||||||
|
"go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -84,6 +85,8 @@ Member:
|
|||||||
Maximum client request size in bytes the server will accept.
|
Maximum client request size in bytes the server will accept.
|
||||||
--max-concurrent-streams 'math.MaxUint32'
|
--max-concurrent-streams 'math.MaxUint32'
|
||||||
Maximum concurrent streams that each client can open at a time.
|
Maximum concurrent streams that each client can open at a time.
|
||||||
|
--enable-grpc-gateway
|
||||||
|
Enable GRPC gateway.
|
||||||
--grpc-keepalive-min-time '5s'
|
--grpc-keepalive-min-time '5s'
|
||||||
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'
|
||||||
@ -93,7 +96,11 @@ Member:
|
|||||||
--socket-reuse-port 'false'
|
--socket-reuse-port 'false'
|
||||||
Enable to set socket option SO_REUSEPORT on listeners allowing rebinding of a port already in use.
|
Enable to set socket option SO_REUSEPORT on listeners allowing rebinding of a port already in use.
|
||||||
--socket-reuse-address 'false'
|
--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:
|
Clustering:
|
||||||
--initial-advertise-peer-urls 'http://localhost:2380'
|
--initial-advertise-peer-urls 'http://localhost:2380'
|
||||||
@ -145,6 +152,10 @@ Security:
|
|||||||
Path to the client server TLS key file.
|
Path to the client server TLS key file.
|
||||||
--client-cert-auth 'false'
|
--client-cert-auth 'false'
|
||||||
Enable client cert authentication.
|
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 ''
|
--client-crl-file ''
|
||||||
Path to the client certificate revocation list file.
|
Path to the client certificate revocation list file.
|
||||||
--client-cert-allowed-hostname ''
|
--client-cert-allowed-hostname ''
|
||||||
@ -167,6 +178,10 @@ Security:
|
|||||||
Allowed TLS hostname for inter peer authentication.
|
Allowed TLS hostname for inter peer authentication.
|
||||||
--peer-auto-tls 'false'
|
--peer-auto-tls 'false'
|
||||||
Peer TLS using self-generated certificates if --peer-key-file and --peer-cert-file are not provided.
|
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'
|
--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.
|
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 ''
|
--peer-crl-file ''
|
||||||
@ -257,6 +272,10 @@ Experimental feature:
|
|||||||
Skip verification of SAN field in client certificate for peer connections.
|
Skip verification of SAN field in client certificate for peer connections.
|
||||||
--experimental-watch-progress-notify-interval '10m'
|
--experimental-watch-progress-notify-interval '10m'
|
||||||
Duration of periodical watch progress notification.
|
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'
|
--experimental-warning-apply-duration '100ms'
|
||||||
Warning is generated if requests take more than this duration.
|
Warning is generated if requests take more than this duration.
|
||||||
--experimental-txn-mode-write-with-shared-buffer 'true'
|
--experimental-txn-mode-write-with-shared-buffer 'true'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user