summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/database/redis_test.go
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2020-12-09 11:55:06 -0800
committerShentubot <shentubot@google.com>2020-12-09 15:56:08 -0800
commit992769c7748d886e7ee1580f0c6cfdfa7ce0eb75 (patch)
treed8cc08dbd93588c7badde91ca1d9dea4ea9edfd7 /test/benchmarks/database/redis_test.go
parent45619ded38b9c9f24b2b7ade812fd903e09ac1b9 (diff)
Add tensorflow, ffmpeg, and redis jobs.
PiperOrigin-RevId: 346603153
Diffstat (limited to 'test/benchmarks/database/redis_test.go')
-rw-r--r--test/benchmarks/database/redis_test.go33
1 files changed, 19 insertions, 14 deletions
diff --git a/test/benchmarks/database/redis_test.go b/test/benchmarks/database/redis_test.go
index 02e67154e..f8075a04b 100644
--- a/test/benchmarks/database/redis_test.go
+++ b/test/benchmarks/database/redis_test.go
@@ -16,6 +16,7 @@ package database
import (
"context"
+ "os"
"testing"
"time"
@@ -24,6 +25,8 @@ import (
"gvisor.dev/gvisor/test/benchmarks/tools"
)
+var h harness.Harness
+
// All possible operations from redis. Note: "ping" will
// run both PING_INLINE and PING_BUILD.
var operations []string = []string{
@@ -111,21 +114,23 @@ func BenchmarkRedis(b *testing.B) {
// Reset profiles and timer to begin the measurement.
server.RestartProfiles()
b.ResetTimer()
- for i := 0; i < b.N; i++ {
- client := clientMachine.GetNativeContainer(ctx, b)
- defer client.CleanUp(ctx)
- out, err := client.Run(ctx, dockerutil.RunOpts{
- Image: "benchmarks/redis",
- }, redis.MakeCmd(ip, serverPort)...)
- if err != nil {
- b.Fatalf("redis-benchmark failed with: %v", err)
- }
-
- // Stop time while we parse results.
- b.StopTimer()
- redis.Report(b, out)
- b.StartTimer()
+ client := clientMachine.GetNativeContainer(ctx, b)
+ defer client.CleanUp(ctx)
+ out, err := client.Run(ctx, dockerutil.RunOpts{
+ Image: "benchmarks/redis",
+ }, redis.MakeCmd(ip, serverPort, b.N /*requests*/)...)
+ if err != nil {
+ b.Fatalf("redis-benchmark failed with: %v", err)
}
+
+ // Stop time while we parse results.
+ b.StopTimer()
+ redis.Report(b, out)
})
}
}
+
+func TestMain(m *testing.M) {
+ h.Init()
+ os.Exit(m.Run())
+}