MCPcopy Index your code
hub / github.com/koding/kite / BenchmarkEtcdAdd

Function BenchmarkEtcdAdd

kontrol/bench_test.go:52–77  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

50}
51
52func BenchmarkEtcdAdd(b *testing.B) {
53 kon.SetStorage(NewEtcd(nil, kon.Kite.Log))
54
55 newKite := func() *protocol.Kite {
56 id := uuid.Must(uuid.NewV4())
57 return &protocol.Kite{
58 Username: "bench-user",
59 Environment: "bench-env",
60 Name: "mathworker",
61 Version: "1.1.1",
62 Region: "bench",
63 Hostname: "bench-host",
64 ID: id.String(),
65 }
66 }
67
68 value := &kontrolprotocol.RegisterValue{
69 URL: "http://localhost:4444/kite",
70 }
71
72 b.ResetTimer()
73
74 for i := 0; i < b.N; i++ {
75 kon.storage.Add(newKite(), value)
76 }
77}
78
79func BenchmarkEtcdGet(b *testing.B) {
80 kon.SetStorage(NewEtcd(nil, kon.Kite.Log))

Callers

nothing calls this directly

Calls 4

NewEtcdFunction · 0.85
SetStorageMethod · 0.80
AddMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected