@@ -21,12 +21,6 @@ import (
2121
2222var rmqPath = "/tmp/rocksmq_client"
2323
24- func TestMain (m * testing.M ) {
25- os .MkdirAll (rmqPath , os .ModePerm )
26- defer os .RemoveAll (rmqPath )
27- os .Exit (m .Run ())
28- }
29-
3024func TestClient (t * testing.T ) {
3125 client , err := NewClient (ClientOptions {})
3226 assert .NotNil (t , client )
@@ -52,8 +46,9 @@ func TestClient_CreateProducer(t *testing.T) {
5246 assert .Nil (t , producer )
5347
5448 /////////////////////////////////////////////////
55- rmqPath := rmqPath + "/test_client1"
56- rmq := newRocksMQ (rmqPath )
49+ os .MkdirAll (rmqPath , os .ModePerm )
50+ rmqPathTest := rmqPath + "/test_client1"
51+ rmq := newRocksMQ (t , rmqPathTest )
5752 defer removePath (rmqPath )
5853 client1 , err := NewClient (ClientOptions {
5954 Server : rmq ,
@@ -91,8 +86,9 @@ func TestClient_Subscribe(t *testing.T) {
9186 assert .Nil (t , consumer )
9287
9388 /////////////////////////////////////////////////
94- rmqPath := rmqPath + "/test_client2"
95- rmq := newRocksMQ (rmqPath )
89+ os .MkdirAll (rmqPath , os .ModePerm )
90+ rmqPathTest := rmqPath + "/test_client2"
91+ rmq := newRocksMQ (t , rmqPathTest )
9692 defer removePath (rmqPath )
9793 client1 , err := NewClient (ClientOptions {
9894 Server : rmq ,
@@ -131,8 +127,9 @@ func TestClient_Subscribe(t *testing.T) {
131127}
132128
133129func TestClient_SeekLatest (t * testing.T ) {
134- rmqPath := rmqPath + "/seekLatest"
135- rmq := newRocksMQ (rmqPath )
130+ os .MkdirAll (rmqPath , os .ModePerm )
131+ rmqPathTest := rmqPath + "/seekLatest"
132+ rmq := newRocksMQ (t , rmqPathTest )
136133 defer removePath (rmqPath )
137134 client , err := NewClient (ClientOptions {
138135 Server : rmq ,
@@ -201,8 +198,9 @@ func TestClient_SeekLatest(t *testing.T) {
201198}
202199
203200func TestClient_consume (t * testing.T ) {
204- rmqPath := rmqPath + "/test_client3"
205- rmq := newRocksMQ (rmqPath )
201+ os .MkdirAll (rmqPath , os .ModePerm )
202+ rmqPathTest := rmqPath + "/test_client3"
203+ rmq := newRocksMQ (t , rmqPathTest )
206204 defer removePath (rmqPath )
207205 client , err := NewClient (ClientOptions {
208206 Server : rmq ,
0 commit comments