[Groonga-commit] groonga/groonga at 3bac31a [master] test grndb check: add tests for --target

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jan 25 17:36:10 JST 2016


Kouhei Sutou	2016-01-25 17:36:10 +0900 (Mon, 25 Jan 2016)

  New Revision: 3bac31add74713090e9a3fc218f2f7d52a55848e
  https://github.com/groonga/groonga/commit/3bac31add74713090e9a3fc218f2f7d52a55848e

  Message:
    test grndb check: add tests for --target

  Modified files:
    test/command_line/suite/grndb/test_check.rb

  Modified: test/command_line/suite/grndb/test_check.rb (+39 -0)
===================================================================
--- test/command_line/suite/grndb/test_check.rb    2016-01-25 17:21:25 +0900 (b6d0e8c)
+++ test/command_line/suite/grndb/test_check.rb    2016-01-25 17:36:10 +0900 (45bd285)
@@ -51,4 +51,43 @@ Database is locked. It may be broken. Re-create the database.
 [Ages.users_age] Index column is locked. It may be broken. Re-create index by '#{grndb_path} recover #{@database_path}'.
     MESSAGE
   end
+
+  sub_test_case "--target" do
+    def test_locked_table
+      groonga("table_create", "Bookmarks", "TABLE_HASH_KEY", "ShortText")
+      groonga("column_create", "Bookmarks", "title",
+              "COLUMN_SCALAR", "ShortText")
+
+      groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText")
+      groonga("column_create", "Users", "age", "COLUMN_SCALAR", "UInt8")
+
+      groonga("lock_acquire", "Bookmarks")
+      groonga("lock_acquire", "Bookmarks.title")
+      groonga("lock_acquire", "Users")
+      groonga("lock_acquire", "Users.age")
+
+      error = assert_raise(CommandRunner::Error) do
+        grndb("check", "--target", "Users")
+      end
+      assert_equal(<<-MESSAGE, error.error_output)
+[Users] Table is locked. It may be broken. (1) Truncate the table (truncate Users) or clear lock of the table (lock_clear Users) and (2) load data again.
+[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_data_column
+      groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText")
+      groonga("column_create", "Users", "age", "COLUMN_SCALAR", "UInt8")
+
+      groonga("lock_acquire", "Users")
+      groonga("lock_acquire", "Users.age")
+
+      error = assert_raise(CommandRunner::Error) do
+        grndb("check", "--target", "Users.age")
+      end
+      assert_equal(<<-MESSAGE, error.error_output)
+[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
+  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index