[Groonga-commit] droonga/drntest at df4b902 [master] Add require-catalog-version directive

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Mar 19 17:45:53 JST 2014


Kouhei Sutou	2014-03-19 17:45:53 +0900 (Wed, 19 Mar 2014)

  New Revision: df4b9024056e7fc1bb8c586a28434e0330ef1d4e
  https://github.com/droonga/drntest/commit/df4b9024056e7fc1bb8c586a28434e0330ef1d4e

  Message:
    Add require-catalog-version directive

  Modified files:
    lib/drntest/configuration.rb
    lib/drntest/directive.rb
    lib/drntest/engine.rb
    lib/drntest/test-executor.rb
    lib/drntest/test-loader.rb

  Modified: lib/drntest/configuration.rb (+2 -0)
===================================================================
--- lib/drntest/configuration.rb    2014-03-19 17:01:52 +0900 (4ce8190)
+++ lib/drntest/configuration.rb    2014-03-19 17:45:53 +0900 (449dd94)
@@ -18,6 +18,7 @@ module Drntest
     attr_accessor :port, :host, :tag
     attr_accessor :base_path, :engine_config
     attr_accessor :fluentd, :fluentd_options
+    attr_accessor :catalog_version
 
     def initialize
       @port            = 24224
@@ -27,6 +28,7 @@ module Drntest
       @engine_config   = "default"
       @fluentd         = "fluentd"
       @fluentd_options = []
+      @catalog_version = "2"
     end
 
     def suite_path

  Modified: lib/drntest/directive.rb (+8 -0)
===================================================================
--- lib/drntest/directive.rb    2014-03-19 17:01:52 +0900 (47f47d6)
+++ lib/drntest/directive.rb    2014-03-19 17:45:53 +0900 (0d600d7)
@@ -47,4 +47,12 @@ module Drntest
       @message = message
     end
   end
+
+  class RequireCatalogVersionDirective < Directive
+    attr_reader :version
+
+    def initialize(version)
+      @version = version
+    end
+  end
 end

  Modified: lib/drntest/engine.rb (+2 -1)
===================================================================
--- lib/drntest/engine.rb    2014-03-19 17:01:52 +0900 (b6f6bbc)
+++ lib/drntest/engine.rb    2014-03-19 17:45:53 +0900 (3b4fbc2)
@@ -46,7 +46,8 @@ module Drntest
       return unless catalog_file.exist?
 
       catalog_json = JSON.parse(catalog_file.read)
-      case catalog_json["version"]
+      @config.catalog_version = catalog_json["version"]
+      case****@confi*****_version
       when 1
         zone = catalog_json["zones"].first
         /\A([^:]+):(\d+)\/(.+)\z/ =~ zone

  Modified: lib/drntest/test-executor.rb (+11 -2)
===================================================================
--- lib/drntest/test-executor.rb    2014-03-19 17:01:52 +0900 (d2cac89)
+++ lib/drntest/test-executor.rb    2014-03-19 17:45:53 +0900 (ffc3116)
@@ -30,7 +30,7 @@ module Drntest
       catch do |abort_tag|
         begin
           Droonga::Client.open(tag: @config.tag, port: @config.port) do |client|
-            context = Context.new(client, @results, abort_tag)
+            context = Context.new(client, @config, @results, abort_tag)
             operations.each do |operation|
               context.execute(operation)
             end
@@ -49,8 +49,9 @@ module Drntest
     end
 
     class Context
-      def initialize(client, results, abort_tag)
+      def initialize(client, config, results, abort_tag)
         @client = client
+        @config = config
         @results = results
         @abort_tag = abort_tag
         @requests = []
@@ -83,6 +84,14 @@ module Drntest
         when OmitDirective
           @results.omit(directive.message)
           abort_execution
+        when RequireCatalogVersionDirective
+          if****@confi*****_version < directive.version
+            message =
+              "require catalog version #{directive.version} or later: " +
+              "<#{@config.catalog_version}>"
+            @results.omit(message)
+            abort_execution
+          end
         end
       end
 

  Modified: lib/drntest/test-loader.rb (+2 -0)
===================================================================
--- lib/drntest/test-loader.rb    2014-03-19 17:01:52 +0900 (d798bad)
+++ lib/drntest/test-loader.rb    2014-03-19 17:45:53 +0900 (92d2067)
@@ -89,6 +89,8 @@ module Drntest
         DisableLoggingDirective.new
       when :omit
         OmitDirective.new(options.first)
+      when :require_catalog_version
+        RequireCatalogVersionDirective.new(Integer(options.first))
       else
         UnknownDirective.new(type, options)
       end
-------------- next part --------------
HTML����������������������������...
Download 



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