Skip to content

Commit

Permalink
Merge pull request #14752 from serathius/linearizability-raftBeforeLe…
Browse files Browse the repository at this point in the history
…aderSend

Linearizability raft before leader send
  • Loading branch information
ahrtr authored Nov 18, 2022
2 parents 6740893 + 371179e commit 2742bdc
Show file tree
Hide file tree
Showing 19 changed files with 210 additions and 170 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/cluster_downgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func startEtcd(t *testing.T, ep e2e.EtcdProcess, execPath string) {
}

func downgradeEnable(t *testing.T, epc *e2e.EtcdProcessCluster, ver *semver.Version) {
c, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
c, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)
testutils.ExecuteWithTimeout(t, 20*time.Second, func() {
err := c.DowngradeEnable(context.TODO(), ver.String())
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/corrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestPeriodicCheckDetectsCorruption(t *testing.T) {
}
})

cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)

for i := 0; i < 10; i++ {
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestCompactHashCheckDetectCorruption(t *testing.T) {
}
})

cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)

for i := 0; i < 10; i++ {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/ctl_v3_auth_no_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func TestCtlV3AuthCertCNWithWithConcurrentOperation(t *testing.T) {
t.Log("Create etcd cluster")
epc, err := e2e.NewEtcdProcessCluster(ctx, t,
e2e.WithClusterSize(1),
e2e.WithClientTLS(e2e.ClientTLS),
e2e.WithClientCertAuthEnabled(true),
e2e.WithClientConnType(e2e.ClientTLS),
e2e.WithClientCertAuthority(true),
)
if err != nil {
t.Fatalf("could not start etcd process cluster (%v)", err)
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/ctl_v3_grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ func TestAuthority(t *testing.T) {
cfg := e2e.NewConfigNoTLS()
cfg.ClusterSize = clusterSize
if tc.useTLS {
cfg.ClientTLS = e2e.ClientTLS
cfg.Client.ConnectionType = e2e.ClientTLS
}
cfg.IsClientAutoTLS = tc.useInsecureTLS
cfg.Client.AutoTLS = tc.useInsecureTLS
// Enable debug mode to get logs with http2 headers (including authority)
cfg.EnvVars = map[string]string{"GODEBUG": "http2debug=2"}

Expand All @@ -98,7 +98,7 @@ func TestAuthority(t *testing.T) {
defer epc.Close()
endpoints := templateEndpoints(t, tc.clientURLPattern, epc)

client, err := e2e.NewEtcdctl(cfg, endpoints)
client, err := e2e.NewEtcdctl(cfg.Client, endpoints)
assert.NoError(t, err)
err = client.Put(ctx, "foo", "bar", config.PutOptions{})
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/ctl_v3_kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func TestCtlV3DelTimeout(t *testing.T) { testCtl(t, delTest, withDialTimeout(0))
func TestCtlV3GetRevokedCRL(t *testing.T) {
cfg := e2e.NewConfig(
e2e.WithClusterSize(1),
e2e.WithClientTLS(e2e.ClientTLS),
e2e.WithIsClientCRL(true),
e2e.WithClientCertAuthEnabled(true),
e2e.WithClientConnType(e2e.ClientTLS),
e2e.WithClientRevokeCerts(true),
e2e.WithClientCertAuthority(true),
)
testCtl(t, testGetRevokedCRL, withCfg(*cfg))
}
Expand All @@ -56,7 +56,7 @@ func testGetRevokedCRL(cx ctlCtx) {
require.ErrorContains(cx.t, err, "context deadline exceeded")

// test accept
cx.epc.Cfg.IsClientCRL = false
cx.epc.Cfg.Client.RevokeCerts = false
if err := ctlV3Put(cx, "k", "v", ""); err != nil {
cx.t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/ctl_v3_move_leader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func testCtlV3MoveLeader(t *testing.T, cfg e2e.EtcdProcessClusterConfig, envVars
}()

var tcfg *tls.Config
if cfg.ClientTLS == e2e.ClientTLS {
if cfg.Client.ConnectionType == e2e.ClientTLS {
tinfo := transport.TLSInfo{
CertFile: e2e.CertPath,
KeyFile: e2e.PrivateKeyPath,
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/ctl_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ func (cx *ctlCtx) prefixArgs(eps []string) []string {
fmap := make(map[string]string)
fmap["endpoints"] = strings.Join(eps, ",")
fmap["dial-timeout"] = cx.dialTimeout.String()
if cx.epc.Cfg.ClientTLS == e2e.ClientTLS {
if cx.epc.Cfg.IsClientAutoTLS {
if cx.epc.Cfg.Client.ConnectionType == e2e.ClientTLS {
if cx.epc.Cfg.Client.AutoTLS {
fmap["insecure-transport"] = "false"
fmap["insecure-skip-tls-verify"] = "true"
} else if cx.epc.Cfg.IsClientCRL {
} else if cx.epc.Cfg.Client.RevokeCerts {
fmap["cacert"] = e2e.CaPath
fmap["cert"] = e2e.RevokedCertPath
fmap["key"] = e2e.RevokedPrivateKeyPath
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/discovery_v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func testClusterUsingV3Discovery(t *testing.T, discoveryClusterSize, targetClust
ds, err := e2e.NewEtcdProcessCluster(context.TODO(), t,
e2e.WithBasePort(2000),
e2e.WithClusterSize(discoveryClusterSize),
e2e.WithClientTLS(clientTlsType),
e2e.WithIsClientAutoTLS(isClientAutoTls),
e2e.WithClientConnType(clientTlsType),
e2e.WithClientAutoTLS(isClientAutoTls),
)
if err != nil {
t.Fatalf("could not start discovery etcd cluster (%v)", err)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/etcd_grpcproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestGrpcProxyAutoSync(t *testing.T) {
assert.NoError(t, proxyProc.Stop())
}()

proxyCtl, err := e2e.NewEtcdctl(e2e.DefaultConfig(), []string{proxyClientURL})
proxyCtl, err := e2e.NewEtcdctl(e2e.ClientConfig{}, []string{proxyClientURL})
require.NoError(t, err)
err = proxyCtl.Put(ctx, "k1", "v1", config.PutOptions{})
require.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/v2store_deprecation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ func TestV2DeprecationSnapshotMatches(t *testing.T) {
snapshotCount := 10
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, lastReleaseData, snapshotCount)
oldMemberDataDir := epc.Procs[0].Config().DataDirPath
cc1, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc1, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)
members1 := addAndRemoveKeysAndMembers(ctx, t, cc1, snapshotCount)
assert.NoError(t, epc.Close())
epc = runEtcdAndCreateSnapshot(t, e2e.CurrentVersion, currentReleaseData, snapshotCount)
newMemberDataDir := epc.Procs[0].Config().DataDirPath
cc2, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc2, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)
members2 := addAndRemoveKeysAndMembers(ctx, t, cc2, snapshotCount)
assert.NoError(t, epc.Close())
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
}
epc := runEtcdAndCreateSnapshot(t, e2e.LastVersion, dataDir, 10)

cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)

lastReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
Expand All @@ -168,7 +168,7 @@ func TestV2DeprecationSnapshotRecover(t *testing.T) {
epc, err = e2e.NewEtcdProcessCluster(context.TODO(), t, e2e.WithConfig(cfg))
assert.NoError(t, err)

cc, err = e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3())
cc, err = e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3())
assert.NoError(t, err)
currentReleaseGetResponse, err := cc.Get(ctx, "", config.GetOptions{Prefix: true})
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/v3_curl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func testV3CurlPutGet(cx ctlCtx) {
if err := e2e.CURLPost(cx.epc, e2e.CURLReq{Endpoint: path.Join(p, "/kv/range"), Value: string(rangeData), Expected: expectGet}); err != nil {
cx.t.Fatalf("failed testV3CurlPutGet get with curl using prefix (%s) (%v)", p, err)
}
if cx.cfg.ClientTLS == e2e.ClientTLSAndNonTLS {
if cx.cfg.Client.ConnectionType == e2e.ClientTLSAndNonTLS {
if err := e2e.CURLPost(cx.epc, e2e.CURLReq{Endpoint: path.Join(p, "/kv/range"), Value: string(rangeData), Expected: expectGet, IsTLS: true}); err != nil {
cx.t.Fatalf("failed testV3CurlPutGet get with curl using prefix (%s) (%v)", p, err)
}
Expand Down
Loading

0 comments on commit 2742bdc

Please sign in to comment.