Skip to content

Commit 87df0a1

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 61d0739 commit 87df0a1

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

tarantool_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,39 @@ func BenchmarkClientSerialTyped(b *testing.B) {
149149
}
150150
}
151151

152+
func BenchmarkClientSerialSQL(b *testing.B) {
153+
// Tarantool supports SQL since version 2.0.0
154+
isLess, err := test_helpers.IsTarantoolVersionLess(2, 0, 0)
155+
if err != nil {
156+
b.Fatal("Could not check the Tarantool version")
157+
}
158+
if isLess {
159+
b.Skip()
160+
}
161+
162+
conn, err := Connect(server, opts)
163+
if err != nil {
164+
b.Errorf("Failed to connect: %s", err)
165+
return
166+
}
167+
defer conn.Close()
168+
169+
spaceNo := 519
170+
_, err = conn.Replace(spaceNo, []interface{}{uint(1111), "hello", "world"})
171+
if err != nil {
172+
b.Errorf("Failed to replace: %s", err)
173+
}
174+
175+
b.ResetTimer()
176+
for i := 0; i < b.N; i++ {
177+
_, err := conn.Execute("SELECT NAME0,NAME1,NAME2 FROM SQL_TEST WHERE NAME0=?", []interface{}{uint(1111)})
178+
if err != nil {
179+
b.Errorf("Select failed: %s", err.Error())
180+
break
181+
}
182+
}
183+
}
184+
152185
func BenchmarkClientFuture(b *testing.B) {
153186
var err error
154187

@@ -368,7 +401,7 @@ func BenchmarkClientParallelMassiveUntyped(b *testing.B) {
368401
close(limit)
369402
}
370403

371-
func BenchmarkClientReplaceParallel(b *testing.B) {
404+
func BenchmarkClientParallelReplace(b *testing.B) {
372405
conn, err := Connect(server, opts)
373406
if err != nil {
374407
b.Errorf("No connection available")
@@ -393,7 +426,7 @@ func BenchmarkClientReplaceParallel(b *testing.B) {
393426
})
394427
}
395428

396-
func BenchmarkClientLargeSelectParallel(b *testing.B) {
429+
func BenchmarkClientParallelLargeSelect(b *testing.B) {
397430
conn, err := Connect(server, opts)
398431
if err != nil {
399432
b.Errorf("No connection available")
@@ -419,7 +452,7 @@ func BenchmarkClientLargeSelectParallel(b *testing.B) {
419452
})
420453
}
421454

422-
func BenchmarkSQLParallel(b *testing.B) {
455+
func BenchmarkClientParallelSQL(b *testing.B) {
423456
// Tarantool supports SQL since version 2.0.0
424457
isLess, err := test_helpers.IsTarantoolVersionLess(2, 0, 0)
425458
if err != nil {
@@ -454,39 +487,6 @@ func BenchmarkSQLParallel(b *testing.B) {
454487
})
455488
}
456489

457-
func BenchmarkSQLSerial(b *testing.B) {
458-
// Tarantool supports SQL since version 2.0.0
459-
isLess, err := test_helpers.IsTarantoolVersionLess(2, 0, 0)
460-
if err != nil {
461-
b.Fatal("Could not check the Tarantool version")
462-
}
463-
if isLess {
464-
b.Skip()
465-
}
466-
467-
conn, err := Connect(server, opts)
468-
if err != nil {
469-
b.Errorf("Failed to connect: %s", err)
470-
return
471-
}
472-
defer conn.Close()
473-
474-
spaceNo := 519
475-
_, err = conn.Replace(spaceNo, []interface{}{uint(1111), "hello", "world"})
476-
if err != nil {
477-
b.Errorf("Failed to replace: %s", err)
478-
}
479-
480-
b.ResetTimer()
481-
for i := 0; i < b.N; i++ {
482-
_, err := conn.Execute("SELECT NAME0,NAME1,NAME2 FROM SQL_TEST WHERE NAME0=?", []interface{}{uint(1111)})
483-
if err != nil {
484-
b.Errorf("Select failed: %s", err.Error())
485-
break
486-
}
487-
}
488-
}
489-
490490
///////////////////
491491

492492
func TestClient(t *testing.T) {

0 commit comments

Comments
 (0)