Skip to content

Commit

Permalink
3.0 tests: use new case-sensitive naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyaksenov committed Dec 26, 2023
1 parent 5bb5c08 commit 0fe136b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ g.test_constraints = function(cg)
local _, age_err = pcall(function()
-- insert_age_error_start
customers:insert { 2, "Bob", 18 }
-- error: Check constraint 'check_person' failed for tuple
-- error: Check constraint 'check_person' failed for a tuple
-- insert_age_error_end
end)

local _, name_err = pcall(function()
-- insert_name_error_start
customers:insert { 3, "Admin", 25 }
-- error: Check constraint 'check_person' failed for tuple
-- error: Check constraint 'check_person' failed for a tuple
-- insert_name_error_end
end)

Expand Down
4 changes: 2 additions & 2 deletions doc/code_snippets/test/sql/check_table_constraint_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ g.test_space_is_updated = function(cg)
-- insert_short_name_start
INSERT INTO author VALUES (3, 'Alex');
/*
- Check constraint 'CHECK_NAME_LENGTH' failed for tuple
- Check constraint 'check_name_length' failed for a tuple
*/
-- insert_short_name_end
]])

-- Tests
t.assert_equals(insert_author_err:unpack().message, "Check constraint 'CHECK_NAME_LENGTH' failed for tuple")
t.assert_equals(insert_author_err:unpack().message, "Check constraint 'check_name_length' failed for a tuple")
end)
end
12 changes: 6 additions & 6 deletions doc/code_snippets/test/sql/foreign_key_table_constraint_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,30 @@ g.test_space_is_updated = function(cg)
-- insert_error_start
INSERT INTO book VALUES (3, 'Eugene Onegin', 3);
/*
- 'Foreign key constraint ''fk_unnamed_BOOK_1'' failed: foreign tuple was not found'
- 'Foreign key constraint ''fk_unnamed_book_1'' failed: foreign tuple was not found'
*/
-- insert_error_end
]])
local _, update_err = box.execute([[
-- update_error_start
UPDATE book SET author_id = 10 WHERE id = 1;
/*
- 'Foreign key constraint ''fk_unnamed_BOOK_1'' failed: foreign tuple was not found'
- 'Foreign key constraint ''fk_unnamed_book_1'' failed: foreign tuple was not found'
*/
-- update_error_end
]])
local _, delete_err = box.execute([[
-- delete_error_start
DELETE FROM author WHERE id = 2;
/*
- 'Foreign key ''fk_unnamed_BOOK_1'' integrity check failed: tuple is referenced'
- 'Foreign key ''fk_unnamed_book_1'' integrity check failed: tuple is referenced'
*/
-- delete_error_end
]])

-- Tests
t.assert_equals(insert_err:unpack().message, "Foreign key constraint 'fk_unnamed_BOOK_1' failed: foreign tuple was not found")
t.assert_equals(update_err:unpack().message, "Foreign key constraint 'fk_unnamed_BOOK_1' failed: foreign tuple was not found")
t.assert_equals(delete_err:unpack().message, "Foreign key 'fk_unnamed_BOOK_1' integrity check failed: tuple is referenced")
t.assert_equals(insert_err:unpack().message, "Foreign key constraint 'fk_unnamed_book_1' failed: foreign tuple was not found")
t.assert_equals(update_err:unpack().message, "Foreign key constraint 'fk_unnamed_book_1' failed: foreign tuple was not found")
t.assert_equals(delete_err:unpack().message, "Foreign key 'fk_unnamed_book_1' integrity check failed: tuple is referenced")
end)
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ g.test_space_is_updated = function(cg)
-- insert_duplicate_author_start
INSERT INTO author VALUES (2, 'Alexander Pushkin');
/*
- Duplicate key exists in unique index "pk_unnamed_AUTHOR_1" in space "AUTHOR" with
- Duplicate key exists in unique index "pk_unnamed_author_1" in space "author" with
old tuple - [2, "Fyodor Dostoevsky"] and new tuple - [2, "Alexander Pushkin"]
*/
-- insert_duplicate_author_end
Expand All @@ -59,14 +59,14 @@ g.test_space_is_updated = function(cg)
-- insert_duplicate_book_start
INSERT INTO book VALUES (2, 'Crime and Punishment');
/*
- Duplicate key exists in unique index "pk_unnamed_BOOK_1" in space "BOOK" with old
- Duplicate key exists in unique index "pk_unnamed_book_1" in space "BOOK" with old
tuple - [2, "Crime and Punishment"] and new tuple - [2, "Crime and Punishment"]
*/
-- insert_duplicate__book_end
]])

-- Tests
t.assert_equals(insert_author_err:unpack().message, "Duplicate key exists in unique index \"pk_unnamed_AUTHOR_1\" in space \"AUTHOR\" with old tuple - [2, \"Fyodor Dostoevsky\"] and new tuple - [2, \"Alexander Pushkin\"]")
t.assert_equals(insert_book_err:unpack().message, "Duplicate key exists in unique index \"pk_unnamed_BOOK_1\" in space \"BOOK\" with old tuple - [2, \"Crime and Punishment\"] and new tuple - [2, \"Crime and Punishment\"]")
t.assert_equals(insert_author_err:unpack().message, "Duplicate key exists in unique index \"pk_unnamed_author_1\" in space \"author\" with old tuple - [2, \"Fyodor Dostoevsky\"] and new tuple - [2, \"Alexander Pushkin\"]")
t.assert_equals(insert_book_err:unpack().message, "Duplicate key exists in unique index \"pk_unnamed_book_1\" in space \"book\" with old tuple - [2, \"Crime and Punishment\"] and new tuple - [2, \"Crime and Punishment\"]")
end)
end
8 changes: 4 additions & 4 deletions doc/code_snippets/test/sql/unique_table_constraint_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ g.test_space_is_updated = function(cg)
-- insert_duplicate_author_start
INSERT INTO author VALUES (3, 'Leo Tolstoy');
/*
- Duplicate key exists in unique index "unique_unnamed_AUTHOR_2" in space "AUTHOR"
- Duplicate key exists in unique index "unique_unnamed_author_2" in space "author"
with old tuple - [1, "Leo Tolstoy"] and new tuple - [3, "Leo Tolstoy"]
*/
-- insert_duplicate_author_end
Expand All @@ -60,14 +60,14 @@ g.test_space_is_updated = function(cg)
-- insert_duplicate_book_start
INSERT INTO book VALUES (3, 'War and Peace', 1);
/*
- Duplicate key exists in unique index "unique_unnamed_BOOK_2" in space "BOOK" with
- Duplicate key exists in unique index "unique_unnamed_book_2" in space "book" with
old tuple - [1, "War and Peace", 1] and new tuple - [3, "War and Peace", 1]
*/
-- insert_duplicate__book_end
]])

-- Tests
t.assert_equals(insert_author_err:unpack().message, "Duplicate key exists in unique index \"unique_unnamed_AUTHOR_2\" in space \"AUTHOR\" with old tuple - [1, \"Leo Tolstoy\"] and new tuple - [3, \"Leo Tolstoy\"]")
t.assert_equals(insert_book_err:unpack().message, "Duplicate key exists in unique index \"unique_unnamed_BOOK_2\" in space \"BOOK\" with old tuple - [1, \"War and Peace\", 1] and new tuple - [3, \"War and Peace\", 1]")
t.assert_equals(insert_author_err:unpack().message, "Duplicate key exists in unique index \"unique_unnamed_author_2\" in space \"author\" with old tuple - [1, \"Leo Tolstoy\"] and new tuple - [3, \"Leo Tolstoy\"]")
t.assert_equals(insert_book_err:unpack().message, "Duplicate key exists in unique index \"unique_unnamed_book_2\" in space \"book\" with old tuple - [1, \"War and Peace\", 1] and new tuple - [3, \"War and Peace\", 1]")
end)
end

0 comments on commit 0fe136b

Please sign in to comment.