Skip to content

Commit 2f9884f

Browse files
committed
test: add test for IsNullable Field flag
1 parent 40fe0d3 commit 2f9884f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

config.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ box.once("init", function()
1616
id = 616,
1717
temporary = true,
1818
if_not_exists = true,
19-
field_count = 7,
19+
field_count = 8,
2020
format = {
2121
{name = "name0", type = "unsigned"},
2222
{name = "name1", type = "unsigned"},
2323
{name = "name2", type = "string"},
2424
{name = "name3", type = "unsigned"},
2525
{name = "name4", type = "unsigned"},
2626
{name = "name5", type = "string"},
27+
{name = "nullable", is_nullable = true},
2728
},
2829
})
2930
st:create_index('primary', {

tarantool_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ func TestSchema(t *testing.T) {
19081908
if space.Engine != "memtx" {
19091909
t.Errorf("space 616 engine should be memtx")
19101910
}
1911-
if space.FieldsCount != 7 {
1911+
if space.FieldsCount != 8 {
19121912
t.Errorf("space 616 has incorrect fields count")
19131913
}
19141914

@@ -1918,14 +1918,14 @@ func TestSchema(t *testing.T) {
19181918
if space.Fields == nil {
19191919
t.Errorf("space.Fields is nill")
19201920
}
1921-
if len(space.FieldsById) != 6 {
1921+
if len(space.FieldsById) != 7 {
19221922
t.Errorf("space.FieldsById len is incorrect")
19231923
}
1924-
if len(space.Fields) != 6 {
1924+
if len(space.Fields) != 7 {
19251925
t.Errorf("space.Fields len is incorrect")
19261926
}
19271927

1928-
var field1, field2, field5, field1n, field5n *Field
1928+
var field1, field2, field5, field1n, field5n, field_nullable *Field
19291929
if field1, ok = space.FieldsById[1]; !ok {
19301930
t.Errorf("field id = 1 was not found")
19311931
}
@@ -1957,6 +1957,12 @@ func TestSchema(t *testing.T) {
19571957
if field2.Type != "string" {
19581958
t.Errorf("field 2 has incorrect Type")
19591959
}
1960+
if field_nullable, ok = space.Fields["nullable"]; !ok {
1961+
t.Errorf("field name = nullable was not found")
1962+
}
1963+
if !field_nullable.IsNullable {
1964+
t.Errorf("field nullable has incorrect IsNullable")
1965+
}
19601966

19611967
if space.IndexesById == nil {
19621968
t.Errorf("space.IndexesById is nill")

0 commit comments

Comments
 (0)