@@ -6,7 +6,7 @@ package.cpath = "../?.so;../?.dylib;./?.so;./?.dylib"
6
6
local mysql = require (' mysql' )
7
7
local json = require (' json' )
8
8
local tap = require (' tap' )
9
- local f = require (' fiber' )
9
+ local fiber = require (' fiber' )
10
10
11
11
local host , port , user , password , db = string.match (os.getenv (' MYSQL' ) or ' ' ,
12
12
" ([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)" )
94
94
function test_conn_concurrent (t , p )
95
95
t :plan (1 )
96
96
local c = p :get ()
97
- local q = f .channel (2 )
98
- local t1 = f .time ()
99
- f .create (test_conn_fiber1 , c , q )
100
- f .create (test_conn_fiber2 , c , q )
97
+ local q = fiber .channel (2 )
98
+ local t1 = fiber .time ()
99
+ fiber .create (test_conn_fiber1 , c , q )
100
+ fiber .create (test_conn_fiber2 , c , q )
101
101
q :get ()
102
102
q :get ()
103
103
p :put (c )
104
- t :ok (f .time () - t1 >= 0.95 , ' concurrent connections' )
104
+ t :ok (fiber .time () - t1 >= 0.95 , ' concurrent connections' )
105
105
end
106
106
107
107
@@ -116,12 +116,16 @@ function test_mysql_int64(t, p)
116
116
p :put (conn )
117
117
end
118
118
119
- tap .test (' connection old api' , test_old_api , conn )
119
+ local test = tap .test (' mysql connector' )
120
+ test :plan (5 )
121
+
122
+ test :test (' connection old api' , test_old_api , conn )
120
123
local pool_conn = p :get ()
121
- tap . test (' connection old api via pool' , test_old_api , pool_conn )
124
+ test : test (' connection old api via pool' , test_old_api , pool_conn )
122
125
p :put (pool_conn )
123
- tap . test ( ' test collection connections ' , test_gc , p )
124
- tap . test ( ' connection concurrent' , test_conn_concurrent , p )
125
- tap . test (' int64' , test_mysql_int64 , p )
126
+ test : test ( ' garbage collection' , test_gc , p )
127
+ test : test ( ' concurrent connections ' , test_conn_concurrent , p )
128
+ test : test (' int64' , test_mysql_int64 , p )
126
129
p :close ()
127
130
131
+ os.exit (test :check () and 0 or 1 )
0 commit comments