Kouhei Sutou
null+****@clear*****
Mon Jan 25 15:24:09 JST 2016
Kouhei Sutou 2016-01-25 15:24:09 +0900 (Mon, 25 Jan 2016) New Revision: 2d82a87da879c7f5ba1a35505e518a235ce80f59 https://github.com/groonga/groonga/commit/2d82a87da879c7f5ba1a35505e518a235ce80f59 Message: test grndb check: add a test for locked index column case Modified files: test/command_line/helper/command_runner.rb test/command_line/suite/grndb/test_check.rb Modified: test/command_line/helper/command_runner.rb (+16 -0) =================================================================== --- test/command_line/helper/command_runner.rb 2016-01-25 15:13:19 +0900 (006b622) +++ test/command_line/helper/command_runner.rb 2016-01-25 15:24:09 +0900 (f77e140) @@ -55,4 +55,20 @@ failed to run: #{command_line.join(" ")} command_line.concat(arguments) run_command(*command_line) end + + def find_program(name) + ENV["PATH"].split(File::PATH_SEPARATOR).each do |path| + lt_program_path = File.join(path, ".libs", "lt-#{name}") + return lt_program_path if File.exist?(lt_program_path) + + program_path = File.join(path, name) + return program_path if File.exist?(program_path) + end + + nil + end + + def grndb_path + find_program("grndb") + end end Modified: test/command_line/suite/grndb/test_check.rb (+17 -0) =================================================================== --- test/command_line/suite/grndb/test_check.rb 2016-01-25 15:13:19 +0900 (5a5d63d) +++ test/command_line/suite/grndb/test_check.rb 2016-01-25 15:24:09 +0900 (b6d0e8c) @@ -34,4 +34,21 @@ Database is locked. It may be broken. Re-create the database. [Users.age] Data column is locked. It may be broken. (1) Truncate the column (truncate Users.age) or clear lock of the column (lock_clear Users.age) and (2) load data again. MESSAGE end + + def test_locked_index_column + groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText") + groonga("column_create", "Users", "age", "COLUMN_SCALAR", "UInt8") + + groonga("table_create", "Ages", "TABLE_PAT_KEY", "UInt8") + groonga("column_create", "Ages", "users_age", "COLUMN_INDEX", "Users", "age") + + groonga("lock_acquire", "Ages.users_age") + + error = assert_raise(CommandRunner::Error) do + grndb("check") + end + assert_equal(<<-MESSAGE, error.error_output) +[Ages.users_age] Index column is locked. It may be broken. Re-create index by '#{grndb_path} recover #{@database_path}'. + MESSAGE + end end -------------- next part -------------- HTML����������������������������...Download