[Groonga-commit] groonga/groonga at 02b1e54 [master] grndb recover: add a test for --force-truncate with data column

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Apr 2 15:10:29 JST 2018


Kouhei Sutou	2018-04-02 15:10:29 +0900 (Mon, 02 Apr 2018)

  New Revision: 02b1e54b43a2fa27e84c868b2e447ac62fbec045
  https://github.com/groonga/groonga/commit/02b1e54b43a2fa27e84c868b2e447ac62fbec045

  Message:
    grndb recover: add a test for --force-truncate with data column

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

  Modified: test/command_line/suite/grndb/test_recover.rb (+23 -8)
===================================================================
--- test/command_line/suite/grndb/test_recover.rb    2018-04-02 15:06:26 +0900 (452dfb204)
+++ test/command_line/suite/grndb/test_recover.rb    2018-04-02 15:10:29 +0900 (4702bac09)
@@ -50,17 +50,32 @@ object corrupt: <[db][recover] table may be broken: <Users>: please truncate the
     end
   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.age")
-    error = assert_raise(CommandRunner::Error) do
-      grndb("recover")
+  sub_test_case("locked data column") do
+    def setup
+      groonga("table_create", "Users", "TABLE_HASH_KEY", "ShortText")
+      groonga("column_create", "Users", "age", "COLUMN_SCALAR", "UInt8")
+      groonga("lock_acquire", "Users.age")
+
+      _id, _name, path, *_ = JSON.parse(groonga("column_list Users").output)[1][2]
+      @column_path = path
     end
-    assert_equal(<<-MESSAGE, error.error_output)
+
+    def test_default
+      error = assert_raise(CommandRunner::Error) do
+        grndb("recover")
+      end
+      assert_equal(<<-MESSAGE, error.error_output)
 Failed to recover database: <#{@database_path}>
 object corrupt: <[db][recover] column may be broken: <Users.age>: please truncate the column (or clear lock of the column) and load data again>(-55)
-    MESSAGE
+      MESSAGE
+    end
+
+    def test_force_truncate
+      result = grndb("recover", "--force-truncate")
+      assert_equal(<<-MESSAGE, result.error_output)
+[Users.age] Truncated broken object: <#{@column_path}>
+      MESSAGE
+    end
   end
 
   def test_locked_index_column
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180402/af199ce3/attachment.htm 



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