@@ -20,6 +20,7 @@ import (
2020 "bytes"
2121 "context"
2222 "io/ioutil"
23+ "os"
2324 "testing"
2425
2526 "github.com/codenotary/immudb/cmd/helper"
@@ -53,8 +54,12 @@ var pwReaderMock = &clienttest.PasswordReaderMock{
5354
5455func TestCommandLine_Connect (t * testing.T ) {
5556 log .Info ("TestCommandLine_Connect" )
56- bs := servertest .NewBufconnServer (server.Options {}.WithAuth (false ).WithInMemoryStore (true ).WithAdminPassword (auth .SysAdminPassword ))
57- bs .Start ()
57+ options := server.Options {}.WithAuth (false ).WithAdminPassword (auth .SysAdminPassword )
58+ bs := servertest .NewBufconnServer (options )
59+
60+ go func () { bs .Start () }()
61+
62+ defer os .RemoveAll (options .Dir )
5863
5964 dialOptions := []grpc.DialOption {
6065 grpc .WithContextDialer (bs .Dialer ), grpc .WithInsecure (),
@@ -71,8 +76,12 @@ func TestCommandLine_Connect(t *testing.T) {
7176
7277func TestCommandLine_Disconnect (t * testing.T ) {
7378 log .Info ("TestCommandLine_Disconnect" )
74- bs := servertest .NewBufconnServer (server.Options {}.WithAuth (false ).WithInMemoryStore (true ).WithAdminPassword (auth .SysAdminPassword ))
75- bs .Start ()
79+ options := server.Options {}.WithAuth (false ).WithAdminPassword (auth .SysAdminPassword )
80+ bs := servertest .NewBufconnServer (options )
81+
82+ go func () { bs .Start () }()
83+
84+ defer os .RemoveAll (options .Dir )
7685
7786 dialOptions := []grpc.DialOption {
7887 grpc .WithContextDialer (bs .Dialer ), grpc .WithInsecure (),
@@ -118,9 +127,12 @@ func (c scIClientInnerMock) Login(ctx context.Context, user []byte, pass []byte)
118127}
119128
120129func TestCommandLine_LoginLogout (t * testing.T ) {
121- options := server.Options {}.WithAuth (true ).WithInMemoryStore ( true ). WithAdminPassword (auth .SysAdminPassword )
130+ options := server.Options {}.WithAuth (true ).WithAdminPassword (auth .SysAdminPassword )
122131 bs := servertest .NewBufconnServer (options )
123- bs .Start ()
132+
133+ go func () { bs .Start () }()
134+
135+ defer os .RemoveAll (options .Dir )
124136
125137 cl := commandline {}
126138 cmd , _ := cl .NewCmd ()
@@ -187,9 +199,12 @@ func TestCommandLine_LoginLogout(t *testing.T) {
187199}
188200
189201func TestCommandLine_CheckLoggedIn (t * testing.T ) {
190- options := server.Options {}.WithAuth (true ).WithInMemoryStore ( true ). WithAdminPassword (auth .SysAdminPassword )
202+ options := server.Options {}.WithAuth (true ).WithAdminPassword (auth .SysAdminPassword )
191203 bs := servertest .NewBufconnServer (options )
192- bs .Start ()
204+
205+ go func () { bs .Start () }()
206+
207+ defer os .RemoveAll (options .Dir )
193208
194209 cl := commandline {}
195210 cmd , _ := cl .NewCmd ()
0 commit comments