Skip to content

Commit

Permalink
Merge pull request etcd-io#16674 from serathius/reuse-embed-config
Browse files Browse the repository at this point in the history
Reuse embed.Config in e2e cluster config
  • Loading branch information
serathius committed Oct 2, 2023
2 parents 0c0128a + 11b441b commit 788070e
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 138 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/corrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestEtcdCorruptHash(t *testing.T) {
cfg := e2e.NewConfigNoTLS()

// trigger snapshot so that restart member can load peers from disk
cfg.SnapshotCount = 3
cfg.ServerConfig.SnapshotCount = 3

testCtl(t, corruptTest, withQuorum(),
withCfg(*cfg),
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/ctl_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ func withFlagByEnv() ctlOption {
// may be overwritten by `withCfg`.
func withMaxConcurrentStreams(streams uint32) ctlOption {
return func(cx *ctlCtx) {
cx.cfg.MaxConcurrentStreams = streams
cx.cfg.ServerConfig.MaxConcurrentStreams = streams
}
}

func withLogLevel(logLevel string) ctlOption {
return func(cx *ctlCtx) {
cx.cfg.LogLevel = logLevel
cx.cfg.ServerConfig.LogLevel = logLevel
}
}

Expand All @@ -221,9 +221,9 @@ func testCtlWithOffline(t *testing.T, testFunc func(ctlCtx), testOfflineFunc fun
if !ret.quorum {
ret.cfg = *e2e.ConfigStandalone(ret.cfg)
}
ret.cfg.StrictReconfigCheck = !ret.disableStrictReconfigCheck
ret.cfg.ServerConfig.StrictReconfigCheck = !ret.disableStrictReconfigCheck
if ret.initialCorruptCheck {
ret.cfg.InitialCorruptCheck = ret.initialCorruptCheck
ret.cfg.ServerConfig.ExperimentalInitialCorruptCheck = ret.initialCorruptCheck
}
if testOfflineFunc != nil {
ret.cfg.KeepDataDir = true
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/etcd_mix_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func mixVersionsSnapshotTestByAddingMember(t *testing.T, clusterVersion, newInst
// start a new etcd instance, which will receive a snapshot from the leader.
newCfg := *epc.Cfg
newCfg.Version = newInstanceVersion
newCfg.SnapshotCatchUpEntries = 10
newCfg.ServerConfig.SnapshotCatchUpEntries = 10
t.Log("Starting a new etcd instance")
_, err = epc.StartNewProc(context.TODO(), &newCfg, t, false /* addAsLearner */)
require.NoError(t, err, "failed to start the new etcd instance: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/v3_cipher_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestCurlV3CipherSuitesMismatch(t *testing.T) { testCurlV3CipherSuites(t, fa
func testCurlV3CipherSuites(t *testing.T, valid bool) {
cc := e2e.NewConfigClientTLS()
cc.ClusterSize = 1
cc.CipherSuites = []string{
cc.ServerConfig.CipherSuites = []string{
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/v3_curl_maxstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ func testCurlV3MaxStream(t *testing.T, reachLimit bool, opts ...ctlOption) {
// (a) generate ${concurrentNumber} concurrent watch streams;
// (b) submit a range request.
var wg sync.WaitGroup
concurrentNumber := cx.cfg.MaxConcurrentStreams - 1
concurrentNumber := cx.cfg.ServerConfig.MaxConcurrentStreams - 1
expectedResponse := `"revision":"`
if reachLimit {
concurrentNumber = cx.cfg.MaxConcurrentStreams
concurrentNumber = cx.cfg.ServerConfig.MaxConcurrentStreams
expectedResponse = "Operation timed out"
}
wg.Add(int(concurrentNumber))
t.Logf("Running the test, MaxConcurrentStreams: %d, concurrentNumber: %d, expected range's response: %s\n",
cx.cfg.MaxConcurrentStreams, concurrentNumber, expectedResponse)
cx.cfg.ServerConfig.MaxConcurrentStreams, concurrentNumber, expectedResponse)

closeServerCh := make(chan struct{})
submitConcurrentWatch(cx, int(concurrentNumber), &wg, closeServerCh)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/watch_delay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestWatchDelayForPeriodicProgressNotification(t *testing.T) {
e2e.BeforeTest(t)
for _, tc := range tcs {
tc := tc
tc.config.WatchProcessNotifyInterval = watchResponsePeriod
tc.config.ServerConfig.ExperimentalWatchProgressNotifyInterval = watchResponsePeriod
t.Run(tc.name, func(t *testing.T) {
clus, err := e2e.NewEtcdProcessCluster(context.Background(), t, e2e.WithConfig(&tc.config))
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 788070e

Please sign in to comment.