[Groonga-commit] groonga/grntest at b9cf2fb [master] Support "disk_usage" normalization

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Aug 16 09:30:24 JST 2017


Kouhei Sutou	2017-08-16 09:30:24 +0900 (Wed, 16 Aug 2017)

  New Revision: b9cf2fb3446dfe61c430b84c8cb4f1430dd9d053
  https://github.com/groonga/grntest/commit/b9cf2fb3446dfe61c430b84c8cb4f1430dd9d053

  Message:
    Support "disk_usage" normalization

  Modified files:
    lib/grntest/test-runner.rb

  Modified: lib/grntest/test-runner.rb (+24 -7)
===================================================================
--- lib/grntest/test-runner.rb    2017-08-16 09:20:04 +0900 (dc9e6b7)
+++ lib/grntest/test-runner.rb    2017-08-16 09:30:24 +0900 (1efdf49)
@@ -675,15 +675,32 @@ http {
           exception["message"] = normalize_error_message(message)
           body.merge("exception" => exception)
         else
-          body.each do |key, value|
-            case value
-            when Hash
-              path = value["path"]
-              value["path"] = normalize_plugin_path(path) if path
-            end
+          normalize_body_recursive(body)
+        end
+      else
+        body
+      end
+    end
+
+    def normalize_body_recursive(body)
+      case body
+      when Array
+        body.collect do |value|
+          normalize_body_recursive(value)
+        end
+      when Hash
+        normalized_body = {}
+        body.each do |key, value|
+          case key
+          when "path"
+            normalized_body[key] = normalize_plugin_path(value)
+          when "disk_usage"
+            normalized_body[key] = 0
+          else
+            normalized_body[key] = normalize_body_recursive(value)
           end
-          body
         end
+        normalized_body
       else
         body
       end
-------------- next part --------------
HTML����������������������������...
下載 



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