Skip to content

Commit cc4f8d0

Browse files
authored
Merge pull request #577 from codenotary/use_embedded_z
Use embedded store
2 parents 3e27a54 + 7250a8c commit cc4f8d0

File tree

208 files changed

+11270
-17323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+11270
-17323
lines changed

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,24 @@ build/codegen:
9292
$(PROTOC) -I pkg/api/schema/ pkg/api/schema/schema.proto \
9393
-I${GOPATH}/pkg/mod \
9494
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected]/third_party/googleapis \
95-
-I${GOPATH}/pkg/mod/github.com/dgraph-io/badger/[email protected] \
9695
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected] \
9796
--go_out=plugins=grpc,paths=source_relative:pkg/api/schema
9897

9998
$(PROTOC) -I pkg/api/schema/ pkg/api/schema/schema.proto \
10099
-I${GOPATH}/pkg/mod \
101100
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected]/third_party/googleapis \
102-
-I${GOPATH}/pkg/mod/github.com/dgraph-io/badger/[email protected] \
103101
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected] \
104102
--grpc-gateway_out=logtostderr=true,paths=source_relative:pkg/api/schema \
105103

106104
$(PROTOC) -I pkg/api/schema/ pkg/api/schema/schema.proto \
107105
-I${GOPATH}/pkg/mod \
108106
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected]/third_party/googleapis \
109-
-I${GOPATH}/pkg/mod/github.com/dgraph-io/badger/[email protected] \
110107
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected] \
111108
--swagger_out=logtostderr=true:pkg/api/schema
112109

113110
$(PROTOC) -I pkg/api/schema/ pkg/api/schema/schema.proto \
114111
-I${GOPATH}/pkg/mod \
115112
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected]/third_party/googleapis \
116-
-I${GOPATH}/pkg/mod/github.com/dgraph-io/badger/[email protected] \
117113
-I${GOPATH}/pkg/mod/github.com/grpc-ecosystem/[email protected] \
118114
--doc_out=pkg/api/schema --doc_opt=markdown,docs.md \
119115

cmd/immuadmin/command/backup_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
package immuadmin
1818

19+
/*
1920
import (
2021
"context"
2122
"errors"
@@ -857,3 +858,4 @@ func TestCommandlineBck_ConfigChainErr(t *testing.T) {
857858
err := cc(cmd, []string{})
858859
assert.Error(t, err)
859860
}
861+
*/

cmd/immuadmin/command/commandline_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
package immuadmin
1818

19+
/*
1920
import (
2021
"context"
2122
"errors"
@@ -141,3 +142,4 @@ func TestCommandline_ConfigChainErr(t *testing.T) {
141142
err := cc(cmd, []string{})
142143
assert.Error(t, err)
143144
}
145+
*/

cmd/immuadmin/command/database_test.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ package immuadmin
33
import (
44
"bytes"
55
"context"
6+
"io/ioutil"
7+
"os"
8+
"strings"
9+
"testing"
10+
611
"github.com/codenotary/immudb/cmd/immuclient/immuclienttest"
712
"github.com/codenotary/immudb/pkg/client"
813
"github.com/codenotary/immudb/pkg/server"
914
"github.com/codenotary/immudb/pkg/server/servertest"
1015
"google.golang.org/grpc"
1116
"google.golang.org/grpc/metadata"
12-
"io/ioutil"
13-
"strings"
14-
"testing"
1517
)
1618

1719
func TestDatabaseList(t *testing.T) {
18-
bs := servertest.NewBufconnServer(server.DefaultOptions().WithAuth(true).WithInMemoryStore(true))
19-
bs.Start()
20+
options := server.DefaultOptions().WithAuth(true)
21+
bs := servertest.NewBufconnServer(options)
22+
23+
go func() { bs.Start() }()
24+
25+
defer os.RemoveAll(options.Dir)
2026

2127
pr := &immuclienttest.PasswordReader{
2228
Pass: []string{"immudb"},
@@ -69,8 +75,12 @@ func TestDatabaseList(t *testing.T) {
6975
}
7076

7177
func TestDatabaseCreate(t *testing.T) {
72-
bs := servertest.NewBufconnServer(server.DefaultOptions().WithAuth(true).WithInMemoryStore(true))
73-
bs.Start()
78+
options := server.DefaultOptions().WithAuth(true)
79+
bs := servertest.NewBufconnServer(options)
80+
81+
go func() { bs.Start() }()
82+
83+
defer os.RemoveAll(options.Dir)
7484

7585
pr := &immuclienttest.PasswordReader{
7686
Pass: []string{"immudb"},

cmd/immuadmin/command/login_errors_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
package immuadmin
1818

19+
/*
1920
import (
2021
"bytes"
2122
"context"
@@ -233,3 +234,4 @@ func TestLoginLogoutErrors(t *testing.T) {
233234
require.Equal(t, "logged out\n", string(outputBytes))
234235
cmdOutput.Reset()
235236
}
237+
*/

cmd/immuadmin/command/login_test.go

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5455
func 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

7277
func 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

120129
func 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

189201
func 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()

cmd/immuadmin/command/print_tree_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package immuadmin
22

3+
/*
34
import (
45
"bytes"
56
"context"
@@ -72,3 +73,4 @@ func TestCommandLine_PrintTree(t *testing.T) {
7273
assert.Contains(t, string(out), "Immudb Merkle Tree")
7374
7475
}
76+
*/

cmd/immuadmin/command/serverconfig_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ func TestCommandLine_ServerconfigAuth(t *testing.T) {
4242
panic(err)
4343
}
4444

45-
options := server.Options{}.WithAuth(false).WithInMemoryStore(true).WithConfig("/tmp/immudb.toml").WithAdminPassword(auth.SysAdminPassword)
45+
options := server.Options{}.WithAuth(false).WithConfig("/tmp/immudb.toml").WithAdminPassword(auth.SysAdminPassword)
4646
bs := servertest.NewBufconnServer(options)
47-
bs.Start()
47+
48+
go func() { bs.Start() }()
49+
50+
defer os.RemoveAll(options.Dir)
4851

4952
dialOptions := []grpc.DialOption{
5053
grpc.WithContextDialer(bs.Dialer), grpc.WithInsecure(),
@@ -93,9 +96,13 @@ func TestCommandLine_ServerconfigMtls(t *testing.T) {
9396
if err != nil {
9497
panic(err)
9598
}
96-
options := server.Options{}.WithAuth(false).WithInMemoryStore(true).WithConfig("/tmp/immudb.toml").WithAdminPassword(auth.SysAdminPassword)
99+
100+
options := server.Options{}.WithAuth(false).WithConfig("/tmp/immudb.toml").WithAdminPassword(auth.SysAdminPassword)
97101
bs := servertest.NewBufconnServer(options)
98-
bs.Start()
102+
103+
go func() { bs.Start() }()
104+
105+
defer os.RemoveAll(options.Dir)
99106

100107
dialOptions := []grpc.DialOption{
101108
grpc.WithContextDialer(bs.Dialer), grpc.WithInsecure(),

cmd/immuadmin/command/stats_test.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"io/ioutil"
2323
"log"
2424
"net/http"
25+
"os"
2526
"testing"
2627

2728
"github.com/codenotary/immudb/cmd/immuadmin/command/stats/statstest"
@@ -35,8 +36,12 @@ import (
3536
)
3637

3738
func TestStats_Status(t *testing.T) {
38-
bs := servertest.NewBufconnServer(server.Options{}.WithAuth(false).WithInMemoryStore(true).WithAdminPassword(auth.SysAdminPassword))
39-
bs.Start()
39+
options := server.Options{}.WithAuth(false).WithAdminPassword(auth.SysAdminPassword)
40+
bs := servertest.NewBufconnServer(options)
41+
42+
go func() { bs.Start() }()
43+
44+
defer os.RemoveAll(options.Dir)
4045

4146
dialOptions := []grpc.DialOption{
4247
grpc.WithContextDialer(bs.Dialer), grpc.WithInsecure(),
@@ -73,8 +78,12 @@ func TestStats_Status(t *testing.T) {
7378
}
7479

7580
func TestStats_StatsText(t *testing.T) {
76-
bs := servertest.NewBufconnServer(server.Options{}.WithAuth(false).WithInMemoryStore(true).WithAdminPassword(auth.SysAdminPassword))
77-
bs.Start()
81+
options := server.Options{}.WithAuth(false).WithAdminPassword(auth.SysAdminPassword)
82+
bs := servertest.NewBufconnServer(options)
83+
84+
go func() { bs.Start() }()
85+
86+
defer os.RemoveAll(options.Dir)
7887

7988
handler := http.NewServeMux()
8089
handler.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
@@ -122,8 +131,12 @@ func TestStats_StatsText(t *testing.T) {
122131
}
123132

124133
func TestStats_StatsRaw(t *testing.T) {
125-
bs := servertest.NewBufconnServer(server.Options{}.WithAuth(false).WithInMemoryStore(true).WithAdminPassword(auth.SysAdminPassword))
126-
bs.Start()
134+
options := server.Options{}.WithAuth(false).WithAdminPassword(auth.SysAdminPassword)
135+
bs := servertest.NewBufconnServer(options)
136+
137+
go func() { bs.Start() }()
138+
139+
defer os.RemoveAll(options.Dir)
127140

128141
handler := http.NewServeMux()
129142
handler.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {

cmd/immuadmin/command/user_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
package immuadmin
1818

19+
/*
1920
import (
2021
"bytes"
2122
"context"
@@ -684,3 +685,4 @@ func TestUserPermissionErrors(t *testing.T) {
684685
_, err = cl.setUserPermission(args)
685686
require.Equal(t, errChangePermission, err)
686687
}
688+
*/

0 commit comments

Comments
 (0)