Skip to content

Commit 51f07e2

Browse files
committed
test: fix benchmark tests names
When using go test tool with different regexp for filtering test functions, it is sometimes helpful to filter some of them with any prefix like BenchmarkClientSerial or BenchmarkClientParallel. This way it is possible to get results just for one type of load. Follows up #62 Follows up #122
1 parent 72d7457 commit 51f07e2

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tarantool_test.go

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,39 @@ func BenchmarkClientSerialTyped(b *testing.B) {
136136
}
137137
}
138138

139+
func BenchmarkClientSerialSQL(b *testing.B) {
140+
// Tarantool supports SQL since version 2.0.0
141+
isLess, err := test_helpers.IsTarantoolVersionLess(2, 0, 0)
142+
if err != nil {
143+
b.Fatal("Could not check the Tarantool version")
144+
}
145+
if isLess {
146+
b.Skip()
147+
}
148+
149+
conn, err := Connect(server, opts)
150+
if err != nil {
151+
b.Errorf("Failed to connect: %s", err)
152+
return
153+
}
154+
defer conn.Close()
155+
156+
spaceNo := 519
157+
_, err = conn.Replace(spaceNo, []interface{}{uint(1111), "hello", "world"})
158+
if err != nil {
159+
b.Errorf("Failed to replace: %s", err)
160+
}
161+
162+
b.ResetTimer()
163+
for i := 0; i < b.N; i++ {
164+
_, err := conn.Execute("SELECT NAME0,NAME1,NAME2 FROM SQL_TEST WHERE NAME0=?", []interface{}{uint(1111)})
165+
if err != nil {
166+
b.Errorf("Select failed: %s", err.Error())
167+
break
168+
}
169+
}
170+
}
171+
139172
func BenchmarkClientFuture(b *testing.B) {
140173
var err error
141174

@@ -398,7 +431,7 @@ func BenchmarkClientLargeSelectParallel(b *testing.B) {
398431
})
399432
}
400433

401-
func BenchmarkSQLParallel(b *testing.B) {
434+
func BenchmarkClientParallelSQL(b *testing.B) {
402435
// Tarantool supports SQL since version 2.0.0
403436
isLess, err := test_helpers.IsTarantoolVersionLess(2, 0, 0)
404437
if err != nil {

0 commit comments

Comments
 (0)