mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd: add a simple endtoend benchmark
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/config"
|
||||
"github.com/coreos/etcd/store"
|
||||
)
|
||||
|
||||
func TestKillLeader(t *testing.T) {
|
||||
@@ -115,6 +116,25 @@ func TestJoinThroughFollower(t *testing.T) {
|
||||
afterTest(t)
|
||||
}
|
||||
|
||||
func BenchmarkEndToEndSet(b *testing.B) {
|
||||
es, hs := buildCluster(3, false)
|
||||
waitLeader(es)
|
||||
b.ResetTimer()
|
||||
for n := 0; n < b.N; n++ {
|
||||
_, err := es[0].p.Set("foo", false, "bar", store.Permanent)
|
||||
if err != nil {
|
||||
panic("unexpect error")
|
||||
}
|
||||
}
|
||||
b.StopTimer()
|
||||
for i := range hs {
|
||||
es[len(hs)-i-1].Stop()
|
||||
}
|
||||
for i := range hs {
|
||||
hs[len(hs)-i-1].Close()
|
||||
}
|
||||
}
|
||||
|
||||
type leadterm struct {
|
||||
lead int64
|
||||
term int64
|
||||
|
||||
Reference in New Issue
Block a user