func Set(b *testing.B, store raft.StableStore) { // Run Set a number of times for n := 0; n < b.N; n++ { if err := store.Set([]byte{byte(n)}, []byte("val")); err != nil { b.Fatalf("err: %s", err) } } }
func Get(b *testing.B, store raft.StableStore) { // Create some fake data for i := 1; i < 10; i++ { if err := store.Set([]byte{byte(i)}, []byte("val")); err != nil { b.Fatalf("err: %s", err) } } b.ResetTimer() // Run Get a number of times for n := 0; n < b.N; n++ { if _, err := store.Get([]byte{0x05}); err != nil { b.Fatalf("err: %s", err) } } }