Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix SQL and case sensitive cases #341

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
- Incorrect options (`vshard_router`, `fields`, `bucket_id`, `mode`,
`prefer_replica`, `balance`) setup for crud.GetRequest (#335)
- Tests with crud 1.4.0 (#336)
- Tests with case sensitive SQL (#341)

## [1.12.0] - 2023-06-07

Expand Down
12 changes: 6 additions & 6 deletions settings/tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestSQLDefaultEngineSetting(t *testing.T) {
require.Equal(t, []interface{}{[]interface{}{"sql_default_engine", "vinyl"}}, resp.Data)

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

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

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

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

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

// Get a data with full column names in metadata.
exec = tarantool.NewExecuteRequest("SELECT x FROM fkname WHERE id = 1;")
exec = tarantool.NewExecuteRequest("SELECT X FROM FKNAME WHERE ID = 1;")
resp, err = conn.Do(exec).Get()
require.Nil(t, err)
require.NotNil(t, resp)
Expand Down
24 changes: 12 additions & 12 deletions tarantool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,18 +1336,18 @@ func TestClientSessionPush(t *testing.T) {
}

const (
createTableQuery = "CREATE TABLE SQL_SPACE (id STRING PRIMARY KEY, name " +
createTableQuery = "CREATE TABLE SQL_SPACE (ID STRING PRIMARY KEY, NAME " +
"STRING COLLATE \"unicode\" DEFAULT NULL);"
insertQuery = "INSERT INTO SQL_SPACE VALUES (?, ?);"
selectNamedQuery = "SELECT id, name FROM SQL_SPACE WHERE id=:id AND name=:name;"
selectPosQuery = "SELECT id, name FROM SQL_SPACE WHERE id=? AND name=?;"
updateQuery = "UPDATE SQL_SPACE SET name=? WHERE id=?;"
selectNamedQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=:ID AND NAME=:NAME;"
selectPosQuery = "SELECT ID, NAME FROM SQL_SPACE WHERE ID=? AND NAME=?;"
updateQuery = "UPDATE SQL_SPACE SET NAME=? WHERE ID=?;"
enableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = true;"
selectSpanDifQueryNew = "SELECT id||id, name, id FROM seqscan SQL_SPACE WHERE name=?;"
selectSpanDifQueryOld = "SELECT id||id, name, id FROM SQL_SPACE WHERE name=?;"
selectSpanDifQueryNew = "SELECT ID||ID, NAME, ID FROM seqscan SQL_SPACE WHERE NAME=?;"
selectSpanDifQueryOld = "SELECT ID||ID, NAME, ID FROM SQL_SPACE WHERE NAME=?;"
alterTableQuery = "ALTER TABLE SQL_SPACE RENAME TO SQL_SPACE2;"
insertIncrQuery = "INSERT INTO SQL_SPACE2 VALUES (?, ?);"
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE name=?;"
deleteQuery = "DELETE FROM SQL_SPACE2 WHERE NAME=?;"
dropQuery = "DROP TABLE SQL_SPACE2;"
dropQuery2 = "DROP TABLE SQL_SPACE;"
disableFullMetaDataQuery = "SET SESSION \"sql_full_metadata\" = false;"
Expand Down Expand Up @@ -1396,8 +1396,8 @@ func TestSQL(t *testing.T) {
{
selectNamedQuery,
map[string]interface{}{
"id": "1",
"name": "test",
"ID": "1",
"NAME": "test",
},
Response{
SQLInfo: SQLInfo{AffectedCount: 0},
Expand Down Expand Up @@ -1448,22 +1448,22 @@ func TestSQL(t *testing.T) {
FieldName: "COLUMN_1",
FieldIsNullable: false,
FieldIsAutoincrement: false,
FieldSpan: "id||id",
FieldSpan: "ID||ID",
},
{
FieldType: "string",
FieldName: "NAME",
FieldIsNullable: true,
FieldIsAutoincrement: false,
FieldSpan: "name",
FieldSpan: "NAME",
FieldCollation: "unicode",
},
{
FieldType: "string",
FieldName: "ID",
FieldIsNullable: false,
FieldIsAutoincrement: false,
FieldSpan: "id",
FieldSpan: "ID",
FieldCollation: "",
},
}},
Expand Down
Loading