summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/network/node_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/benchmarks/network/node_test.go')
-rw-r--r--test/benchmarks/network/node_test.go20
1 files changed, 5 insertions, 15 deletions
diff --git a/test/benchmarks/network/node_test.go b/test/benchmarks/network/node_test.go
index 3e837a9e4..a1fc82f95 100644
--- a/test/benchmarks/network/node_test.go
+++ b/test/benchmarks/network/node_test.go
@@ -25,8 +25,6 @@ import (
"gvisor.dev/gvisor/test/benchmarks/tools"
)
-var h harness.Harness
-
// BenchmarkNode runs requests using 'hey' against a Node server run on
// 'runtime'. The server responds to requests by grabbing some data in a
// redis instance and returns the data in its reponse. The test loops through
@@ -42,14 +40,9 @@ func BenchmarkNode(b *testing.B) {
if err != nil {
b.Fatalf("Failed to parse parameters: %v", err)
}
- requests := b.N
- if requests < c {
- b.Logf("b.N is %d must be greater than threads %d. Consider running with --test.benchtime=Nx where N >= %d", b.N, c, c)
- requests = c
- }
b.Run(name, func(b *testing.B) {
hey := &tools.Hey{
- Requests: requests,
+ Requests: b.N,
Concurrency: c,
}
runNode(b, hey)
@@ -62,14 +55,14 @@ func runNode(b *testing.B, hey *tools.Hey) {
b.Helper()
// The machine to hold Redis and the Node Server.
- serverMachine, err := h.GetMachine()
+ serverMachine, err := harness.GetMachine()
if err != nil {
b.Fatalf("failed to get machine with: %v", err)
}
defer serverMachine.CleanUp()
// The machine to run 'hey'.
- clientMachine, err := h.GetMachine()
+ clientMachine, err := harness.GetMachine()
if err != nil {
b.Fatalf("failed to get machine with: %v", err)
}
@@ -124,10 +117,8 @@ func runNode(b *testing.B, hey *tools.Hey) {
heyCmd := hey.MakeCmd(servingIP, servingPort)
- nodeApp.RestartProfiles()
- b.ResetTimer()
-
// the client should run on Native.
+ b.ResetTimer()
client := clientMachine.GetNativeContainer(ctx, b)
out, err := client.Run(ctx, dockerutil.RunOpts{
Image: "benchmarks/hey",
@@ -137,11 +128,10 @@ func runNode(b *testing.B, hey *tools.Hey) {
}
// Stop the timer to parse the data and report stats.
- b.StopTimer()
hey.Report(b, out)
}
func TestMain(m *testing.M) {
- h.Init()
+ harness.Init()
os.Exit(m.Run())
}