mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #16688 from serathius/e2e-default-config
Use default embed config in e2e tests
This commit is contained in:
commit
6a96ab7c09
@ -56,19 +56,21 @@ const (
|
||||
ClusterStateFlagNew = "new"
|
||||
ClusterStateFlagExisting = "existing"
|
||||
|
||||
DefaultName = "default"
|
||||
DefaultMaxSnapshots = 5
|
||||
DefaultMaxWALs = 5
|
||||
DefaultMaxTxnOps = uint(128)
|
||||
DefaultWarningApplyDuration = 100 * time.Millisecond
|
||||
DefaultWarningUnaryRequestDuration = 300 * time.Millisecond
|
||||
DefaultMaxRequestBytes = 1.5 * 1024 * 1024
|
||||
DefaultMaxConcurrentStreams = math.MaxUint32
|
||||
DefaultGRPCKeepAliveMinTime = 5 * time.Second
|
||||
DefaultGRPCKeepAliveInterval = 2 * time.Hour
|
||||
DefaultGRPCKeepAliveTimeout = 20 * time.Second
|
||||
DefaultDowngradeCheckTime = 5 * time.Second
|
||||
DefaultAutoCompactionMode = "periodic"
|
||||
DefaultName = "default"
|
||||
DefaultMaxSnapshots = 5
|
||||
DefaultMaxWALs = 5
|
||||
DefaultMaxTxnOps = uint(128)
|
||||
DefaultWarningApplyDuration = 100 * time.Millisecond
|
||||
DefaultWarningUnaryRequestDuration = 300 * time.Millisecond
|
||||
DefaultMaxRequestBytes = 1.5 * 1024 * 1024
|
||||
DefaultMaxConcurrentStreams = math.MaxUint32
|
||||
DefaultGRPCKeepAliveMinTime = 5 * time.Second
|
||||
DefaultGRPCKeepAliveInterval = 2 * time.Hour
|
||||
DefaultGRPCKeepAliveTimeout = 20 * time.Second
|
||||
DefaultDowngradeCheckTime = 5 * time.Second
|
||||
DefaultAutoCompactionMode = "periodic"
|
||||
DefaultAuthToken = "simple"
|
||||
DefaultExperimentalCompactHashCheckTime = time.Minute
|
||||
|
||||
DefaultDiscoveryDialTimeout = 2 * time.Second
|
||||
DefaultDiscoveryRequestTimeOut = 5 * time.Second
|
||||
@ -509,7 +511,7 @@ func NewConfig() *Config {
|
||||
CORS: map[string]struct{}{"*": {}},
|
||||
HostWhitelist: map[string]struct{}{"*": {}},
|
||||
|
||||
AuthToken: "simple",
|
||||
AuthToken: DefaultAuthToken,
|
||||
BcryptCost: uint(bcrypt.DefaultCost),
|
||||
AuthTokenTTL: 300,
|
||||
|
||||
@ -530,7 +532,7 @@ func NewConfig() *Config {
|
||||
ExperimentalMaxLearners: membership.DefaultMaxLearners,
|
||||
|
||||
ExperimentalCompactHashCheckEnabled: false,
|
||||
ExperimentalCompactHashCheckTime: time.Minute,
|
||||
ExperimentalCompactHashCheckTime: DefaultExperimentalCompactHashCheckTime,
|
||||
|
||||
V2Deprecation: config.V2_DEPR_DEFAULT,
|
||||
|
||||
|
@ -30,8 +30,10 @@ import (
|
||||
"go.uber.org/zap/zaptest"
|
||||
|
||||
"go.etcd.io/etcd/api/v3/etcdserverpb"
|
||||
"go.etcd.io/etcd/client/pkg/v3/logutil"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"go.etcd.io/etcd/pkg/v3/proxy"
|
||||
config2 "go.etcd.io/etcd/server/v3/config"
|
||||
"go.etcd.io/etcd/server/v3/embed"
|
||||
"go.etcd.io/etcd/server/v3/etcdserver"
|
||||
"go.etcd.io/etcd/tests/v3/framework/config"
|
||||
@ -177,17 +179,14 @@ type EtcdProcessClusterConfig struct {
|
||||
}
|
||||
|
||||
func DefaultConfig() *EtcdProcessClusterConfig {
|
||||
return &EtcdProcessClusterConfig{
|
||||
cfg := &EtcdProcessClusterConfig{
|
||||
ClusterSize: 3,
|
||||
CN: true,
|
||||
|
||||
ServerConfig: embed.Config{
|
||||
InitialClusterToken: "new",
|
||||
StrictReconfigCheck: true,
|
||||
SnapshotCount: etcdserver.DefaultSnapshotCount,
|
||||
SnapshotCatchUpEntries: etcdserver.DefaultSnapshotCatchUpEntries,
|
||||
},
|
||||
ServerConfig: *embed.NewConfig(),
|
||||
}
|
||||
cfg.ServerConfig.InitialClusterToken = "new"
|
||||
return cfg
|
||||
}
|
||||
|
||||
func NewConfig(opts ...EPClusterOption) *EtcdProcessClusterConfig {
|
||||
@ -553,11 +552,11 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
|
||||
|
||||
args = append(args, cfg.TlsArgs()...)
|
||||
|
||||
if cfg.ServerConfig.AuthToken != "" {
|
||||
if cfg.ServerConfig.AuthToken != "" && cfg.ServerConfig.AuthToken != embed.DefaultAuthToken {
|
||||
args = append(args, "--auth-token", cfg.ServerConfig.AuthToken)
|
||||
}
|
||||
|
||||
if cfg.ServerConfig.V2Deprecation != "" {
|
||||
if cfg.ServerConfig.V2Deprecation != "" && cfg.ServerConfig.V2Deprecation != config2.V2_DEPR_DEFAULT {
|
||||
args = append(args, "--v2-deprecation", string(cfg.ServerConfig.V2Deprecation))
|
||||
}
|
||||
|
||||
@ -565,11 +564,11 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
|
||||
args = append(args, "--discovery", cfg.Discovery)
|
||||
}
|
||||
|
||||
if cfg.ServerConfig.LogLevel != "" {
|
||||
if cfg.ServerConfig.LogLevel != "" && cfg.ServerConfig.LogLevel != logutil.DefaultLogLevel {
|
||||
args = append(args, "--log-level", cfg.ServerConfig.LogLevel)
|
||||
}
|
||||
|
||||
if cfg.ServerConfig.MaxConcurrentStreams != 0 {
|
||||
if cfg.ServerConfig.MaxConcurrentStreams != 0 && cfg.ServerConfig.MaxConcurrentStreams != embed.DefaultMaxConcurrentStreams {
|
||||
args = append(args, "--max-concurrent-streams", fmt.Sprintf("%d", cfg.ServerConfig.MaxConcurrentStreams))
|
||||
}
|
||||
|
||||
@ -579,7 +578,7 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
|
||||
if cfg.ServerConfig.ExperimentalCompactHashCheckEnabled {
|
||||
args = append(args, "--experimental-compact-hash-check-enabled")
|
||||
}
|
||||
if cfg.ServerConfig.ExperimentalCompactHashCheckTime != 0 {
|
||||
if cfg.ServerConfig.ExperimentalCompactHashCheckTime != 0 && cfg.ServerConfig.ExperimentalCompactHashCheckTime != embed.DefaultExperimentalCompactHashCheckTime {
|
||||
args = append(args, "--experimental-compact-hash-check-time", cfg.ServerConfig.ExperimentalCompactHashCheckTime.String())
|
||||
}
|
||||
if cfg.ServerConfig.ExperimentalCompactionBatchLimit != 0 {
|
||||
@ -597,7 +596,7 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
|
||||
if cfg.ServerConfig.ExperimentalWatchProgressNotifyInterval != 0 {
|
||||
args = append(args, "--experimental-watch-progress-notify-interval", cfg.ServerConfig.ExperimentalWatchProgressNotifyInterval.String())
|
||||
}
|
||||
if cfg.ServerConfig.SnapshotCatchUpEntries != etcdserver.DefaultSnapshotCatchUpEntries {
|
||||
if cfg.ServerConfig.SnapshotCatchUpEntries != 0 && cfg.ServerConfig.SnapshotCatchUpEntries != etcdserver.DefaultSnapshotCatchUpEntries {
|
||||
if cfg.Version == CurrentVersion || (cfg.Version == MinorityLastVersion && i <= cfg.ClusterSize/2) || (cfg.Version == QuorumLastVersion && i > cfg.ClusterSize/2) {
|
||||
args = append(args, "--experimental-snapshot-catchup-entries", fmt.Sprintf("%d", cfg.ServerConfig.SnapshotCatchUpEntries))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user