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

Function BenchmarkPostgres

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

Source from the content-addressed store, hash-verified

9)
10
11func BenchmarkPostgres(b *testing.B) {
12 kon.SetStorage(NewPostgres(nil, kon.Kite.Log))
13
14 newKite := func() *protocol.Kite {
15 id := uuid.Must(uuid.NewV4())
16 return &protocol.Kite{
17 Username: "bench-user",
18 Environment: "bench-env",
19 Name: "mathworker",
20 Version: "1.1.1",
21 Region: "bench",
22 Hostname: "bench-host",
23 ID: id.String(),
24 }
25 }
26
27 value := &kontrolprotocol.RegisterValue{
28 URL: "http://localhost:4444/kite",
29 }
30
31 b.ResetTimer()
32
33 for i := 0; i < b.N; i++ {
34 kon.storage.Add(newKite(), value)
35 }
36}
37
38func BenchmarkPostgresGet(b *testing.B) {
39 kon.SetStorage(NewPostgres(nil, kon.Kite.Log))

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected