Skip to content

Commit 6875af2

Browse files
committed
tests: add SQL tests
Added SQL tests. Updated config.lua for creation the space for using SQL in tests. Added the check of Tarantool version to skip SQL tests if tarantool version < 2.0.0. Changed id of the test spaces with id=512 and id=514, cause if using SQL in tarantool there is no ability to set space id explicitly, so it gets created with id=512 by default and conflicts with already existing space with the same id. Follows up #62
1 parent e547fdf commit 6875af2

File tree

4 files changed

+535
-22
lines changed

4 files changed

+535
-22
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ import (
184184
)
185185

186186
func main() {
187-
spaceNo := uint32(512)
187+
spaceNo := uint32(515)
188188
indexNo := uint32(0)
189189

190190
server := "127.0.0.1:3013"

config.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ box.cfg{
66

77
box.once("init", function()
88
local s = box.schema.space.create('test', {
9-
id = 512,
9+
id = 515,
1010
if_not_exists = true,
1111
})
1212
s:create_index('primary', {type = 'tree', parts = {1, 'uint'}, if_not_exists = true})
1313

1414
local st = box.schema.space.create('schematest', {
15-
id = 514,
15+
id = 516,
1616
temporary = true,
1717
if_not_exists = true,
1818
field_count = 7,
@@ -49,6 +49,10 @@ box.once("init", function()
4949
box.schema.user.grant('test', 'execute', 'universe')
5050
box.schema.user.grant('test', 'read,write', 'space', 'test')
5151
box.schema.user.grant('test', 'read,write', 'space', 'schematest')
52+
53+
-- grants for sql tests
54+
box.schema.user.grant('test', 'create,read,write,drop,alter', 'space')
55+
box.schema.user.grant('test', 'create', 'sequence')
5256
end)
5357

5458
local function simple_incr(a)

example_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func ExampleConnection_Select() {
4242
return
4343
}
4444
defer conn.Close()
45-
resp, err := conn.Select(512, 0, 0, 100, tarantool.IterEq, []interface{}{uint(1111)})
45+
resp, err := conn.Select(515, 0, 0, 100, tarantool.IterEq, []interface{}{uint(1111)})
4646
if err != nil {
4747
fmt.Printf("error in select is %v", err)
4848
return
@@ -68,7 +68,7 @@ func ExampleConnection_SelectTyped() {
6868
}
6969
defer conn.Close()
7070
var res []Tuple
71-
err = conn.SelectTyped(512, 0, 0, 100, tarantool.IterEq, tarantool.IntKey{1111}, &res)
71+
err = conn.SelectTyped(515, 0, 0, 100, tarantool.IterEq, tarantool.IntKey{1111}, &res)
7272
if err != nil {
7373
fmt.Printf("error in select is %v", err)
7474
return
@@ -86,7 +86,7 @@ func ExampleConnection_SelectTyped() {
8686
}
8787

8888
func Example() {
89-
spaceNo := uint32(512)
89+
spaceNo := uint32(515)
9090
indexNo := uint32(0)
9191

9292
server := "127.0.0.1:3013"

0 commit comments

Comments
 (0)