Skip to content

Commit a422262

Browse files
committed
test: fix SQL and case sensitive cases
The feature will be introduced in Tarantool 3.0 [1]. 1. tarantool/tarantool#9249
1 parent b6e8aba commit a422262

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
6868
- Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
6969
`prefer_replica`, `balance`) setup for crud.GetRequest (#335)
7070
- Tests with crud 1.4.0 (#336)
71+
- Tests with case sensitive SQL (#341)
7172

7273
## [1.12.0] - 2023-06-07
7374

settings/tarantool_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func TestSQLDefaultEngineSetting(t *testing.T) {
117117
require.Equal(t, []interface{}{[]interface{}{"sql_default_engine", "vinyl"}}, resp.Data)
118118

119119
// Create a space with "CREATE TABLE".
120-
exec := tarantool.NewExecuteRequest("CREATE TABLE t1_vinyl(a INT PRIMARY KEY, b INT, c INT);")
120+
exec := tarantool.NewExecuteRequest("CREATE TABLE T1_VINYL(a INT PRIMARY KEY, b INT, c INT);")
121121
resp, err = conn.Do(exec).Get()
122122
require.Nil(t, err)
123123
require.NotNil(t, resp)
@@ -143,7 +143,7 @@ func TestSQLDefaultEngineSetting(t *testing.T) {
143143
require.Equal(t, []interface{}{[]interface{}{"sql_default_engine", "memtx"}}, resp.Data)
144144

145145
// Create a space with "CREATE TABLE".
146-
exec = tarantool.NewExecuteRequest("CREATE TABLE t2_memtx(a INT PRIMARY KEY, b INT, c INT);")
146+
exec = tarantool.NewExecuteRequest("CREATE TABLE T2_MEMTX(a INT PRIMARY KEY, b INT, c INT);")
147147
resp, err = conn.Do(exec).Get()
148148
require.Nil(t, err)
149149
require.NotNil(t, resp)
@@ -241,14 +241,14 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
241241
defer conn.Close()
242242

243243
// Create a space.
244-
exec := tarantool.NewExecuteRequest("CREATE TABLE fkname(id INT PRIMARY KEY, x INT);")
244+
exec := tarantool.NewExecuteRequest("CREATE TABLE FKNAME(ID INT PRIMARY KEY, X INT);")
245245
resp, err = conn.Do(exec).Get()
246246
require.Nil(t, err)
247247
require.NotNil(t, resp)
248248
require.Equal(t, uint64(1), resp.SQLInfo.AffectedCount)
249249

250250
// Fill it with some data.
251-
exec = tarantool.NewExecuteRequest("INSERT INTO fkname VALUES (1, 1);")
251+
exec = tarantool.NewExecuteRequest("INSERT INTO FKNAME VALUES (1, 1);")
252252
resp, err = conn.Do(exec).Get()
253253
require.Nil(t, err)
254254
require.NotNil(t, resp)
@@ -267,7 +267,7 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
267267
require.Equal(t, []interface{}{[]interface{}{"sql_full_column_names", false}}, resp.Data)
268268

269269
// Get a data with short column names in metadata.
270-
exec = tarantool.NewExecuteRequest("SELECT x FROM fkname WHERE id = 1;")
270+
exec = tarantool.NewExecuteRequest("SELECT X FROM FKNAME WHERE ID = 1;")
271271
resp, err = conn.Do(exec).Get()
272272
require.Nil(t, err)
273273
require.NotNil(t, resp)
@@ -286,7 +286,7 @@ func TestSQLFullColumnNamesSetting(t *testing.T) {
286286
require.Equal(t, []interface{}{[]interface{}{"sql_full_column_names", true}}, resp.Data)
287287

288288
// Get a data with full column names in metadata.
289-
exec = tarantool.NewExecuteRequest("SELECT x FROM fkname WHERE id = 1;")
289+
exec = tarantool.NewExecuteRequest("SELECT X FROM FKNAME WHERE ID = 1;")
290290
resp, err = conn.Do(exec).Get()
291291
require.Nil(t, err)
292292
require.NotNil(t, resp)

tarantool_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -1336,18 +1336,18 @@ func TestClientSessionPush(t *testing.T) {
13361336
}
13371337

13381338
const (
1339-
createTableQuery = "CREATE TABLE SQL_SPACE (id STRING PRIMARY KEY, name " +
1339+
createTableQuery = "CREATE TABLE SQL_SPACE (ID STRING PRIMARY KEY, NAME " +
13401340
"STRING COLLATE \"unicode\" DEFAULT NULL);"
13411341
insertQuery = "INSERT INTO SQL_SPACE VALUES (?, ?);"
1342-
selectNamedQuery = "SELECT id, name FROM SQL_SPACE WHERE id=:id AND name=:name;"
1343-
selectPosQuery = "SELECT id, name FROM SQL_SPACE WHERE id=? AND name=?;"
1344-
updateQuery = "UPDATE SQL_SPACE SET name=? WHERE id=?;"
1342+
selectNamedQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=:ID AND NAME=:NAME;"
1343+
selectPosQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=? AND NAME=?;"
1344+
updateQuery = "UPDATE SQL_SPACE SET NAME=? WHERE ID=?;"
13451345
enableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = true;"
1346-
selectSpanDifQueryNew = "SELECT id||id, name, id FROM seqscan SQL_SPACE WHERE name=?;"
1347-
selectSpanDifQueryOld = "SELECT id||id, name, id FROM SQL_SPACE WHERE name=?;"
1346+
selectSpanDifQueryNew = "SELECT ID||ID, NAME, ID FROM seqscan SQL_SPACE WHERE NAME=?;"
1347+
selectSpanDifQueryOld = "SELECT ID||ID, NAME, ID FROM SQL_SPACE WHERE NAME=?;"
13481348
alterTableQuery = "ALTER TABLE SQL_SPACE RENAME TO SQL_SPACE2;"
13491349
insertIncrQuery = "INSERT INTO SQL_SPACE2 VALUES (?, ?);"
1350-
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE name=?;"
1350+
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE NAME=?;"
13511351
dropQuery = "DROP TABLE SQL_SPACE2;"
13521352
dropQuery2 = "DROP TABLE SQL_SPACE;"
13531353
disableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = false;"
@@ -1396,8 +1396,8 @@ func TestSQL(t *testing.T) {
13961396
{
13971397
selectNamedQuery,
13981398
map[string]interface{}{
1399-
"id": "1",
1400-
"name": "test",
1399+
"ID": "1",
1400+
"NAME": "test",
14011401
},
14021402
Response{
14031403
SQLInfo: SQLInfo{AffectedCount: 0},
@@ -1448,22 +1448,22 @@ func TestSQL(t *testing.T) {
14481448
FieldName: "COLUMN_1",
14491449
FieldIsNullable: false,
14501450
FieldIsAutoincrement: false,
1451-
FieldSpan: "id||id",
1451+
FieldSpan: "ID||ID",
14521452
},
14531453
{
14541454
FieldType: "string",
14551455
FieldName: "NAME",
14561456
FieldIsNullable: true,
14571457
FieldIsAutoincrement: false,
1458-
FieldSpan: "name",
1458+
FieldSpan: "NAME",
14591459
FieldCollation: "unicode",
14601460
},
14611461
{
14621462
FieldType: "string",
14631463
FieldName: "ID",
14641464
FieldIsNullable: false,
14651465
FieldIsAutoincrement: false,
1466-
FieldSpan: "id",
1466+
FieldSpan: "ID",
14671467
FieldCollation: "",
14681468
},
14691469
}},

0 commit comments

Comments
 (0)