mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix test file
This commit is contained in:
parent
d239e5e0dd
commit
65c34457de
@ -150,7 +150,7 @@ func BenchmarkStoreSet(b *testing.B) {
|
||||
func BenchmarkStoreGet(b *testing.B) {
|
||||
s := CreateStore(100)
|
||||
|
||||
keys := GenKeys(100, 5)
|
||||
keys := GenKeys(10000, 5)
|
||||
|
||||
for i, key := range keys {
|
||||
s.Set(key, "barbarbarbarbar", time.Unix(0, 0), uint64(i))
|
||||
|
@ -11,7 +11,7 @@ func GenKeys(num int, depth int) []string {
|
||||
for i := 0; i < num; i++ {
|
||||
|
||||
keys[i] = "/foo/"
|
||||
depth := rand.Intn(depth)
|
||||
depth := rand.Intn(depth) + 1
|
||||
|
||||
for j := 0; j < depth; j++ {
|
||||
keys[i] += "/" + strconv.Itoa(rand.Int())
|
||||
|
@ -1,7 +1,7 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
//"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"testing"
|
||||
@ -64,20 +64,20 @@ func TestStoreGet(t *testing.T) {
|
||||
ts.set("/hello/fooo", NewTestNode("barbarbar"))
|
||||
ts.set("/hello/foooo/foo", NewTestNode("barbarbar"))
|
||||
|
||||
nodes, keys, ok := ts.list("/hello")
|
||||
//nodes, keys, ok := ts.list("/hello")
|
||||
|
||||
if !ok {
|
||||
t.Fatalf("cannot list!")
|
||||
} else {
|
||||
nodes, _ := nodes.([]*Node)
|
||||
length := len(nodes)
|
||||
// if !ok {
|
||||
// t.Fatalf("cannot list!")
|
||||
// } else {
|
||||
// nodes, _ := nodes.([]*Node)
|
||||
// length := len(nodes)
|
||||
|
||||
for i := 0; i < length; i++ {
|
||||
fmt.Println(keys[i], "=", nodes[i].Value)
|
||||
}
|
||||
}
|
||||
// for i := 0; i < length; i++ {
|
||||
// fmt.Println(keys[i], "=", nodes[i].Value)
|
||||
// }
|
||||
// }
|
||||
|
||||
keys = GenKeys(100, 10)
|
||||
keys := GenKeys(100, 10)
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
value := strconv.Itoa(rand.Int())
|
||||
@ -206,15 +206,6 @@ func BenchmarkTreeStoreCopy(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMakeSlice(b *testing.B) {
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
for i := 0; i < 100000; i++ {
|
||||
_ = make([]Node, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkTreeStoreList(b *testing.B) {
|
||||
|
||||
keys := GenKeys(10000, 10)
|
||||
|
Loading…
x
Reference in New Issue
Block a user