Sha256: db9c9b84470a49d6add2d7d002e137375a42906f365dfe4862dcce33ec095d21

Contents?: true

Size: 1.9 KB

Versions: 5

Compression:

Stored size: 1.9 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe "job DSL examples" do
  before(:all) do
    Tengine.plugins.add(Tengine::Job)
  end

  def load_dsl(filename)
    config = {
      :action => "load",
      :tengined => { :load_path => File.expand_path("../../../examples/#{filename}", File.dirname(__FILE__)) },
    }
    @bootstrap = Tengine::Core::Bootstrap.new(config)
    @bootstrap.boot
  end

  example_dir = File.expand_path("../../../examples", File.dirname(__FILE__))

  context "load and bind" do
    Dir.glob("#{example_dir}/*.rb") do |job_dsl_path|
      it "load #{job_dsl_path}" do
        Tengine::Core::Driver.delete_all
        Tengine::Core::HandlerPath.delete_all
        Tengine::Job::Vertex.delete_all
        Tengine::Job::Vertex.count.should == 0
        expect {
          load_dsl(File.basename(job_dsl_path))
        }.to_not raise_error
        Tengine::Job::Vertex.count.should_not == 0
      end

      it "bind #{job_dsl_path}" do
        Tengine::Core::Driver.delete_all
        Tengine::Core::HandlerPath.delete_all
        Tengine::Job::Vertex.delete_all
        load_dsl(File.basename(job_dsl_path))
      end

    end
  end

  context "<BUG>[tenginedがジョブネット定義をロードするパスとして指定したディレクトリ内に更にディレクトリが存在すると、Errorが発生してtenginedが起動できない]" do
    it do
      Tengine::Core::Driver.delete_all
      Tengine::Core::HandlerPath.delete_all
      Tengine::Job::Vertex.delete_all
      Tengine::Job::Vertex.count.should == 0
      expect {
        dsl_dir = File.expand_path("dsls/1060_test_dir1", File.dirname(__FILE__))
        config = {
          :action => "load",
          :tengined => { :load_path => dsl_dir },
        }
        @bootstrap = Tengine::Core::Bootstrap.new(config)
        @bootstrap.boot
      }.to_not raise_error
      Tengine::Job::Vertex.count.should_not == 0
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tengine_job-0.6.13 spec/tengine/job/examples_spec.rb
tengine_job-0.6.12 spec/tengine/job/examples_spec.rb
tengine_job-0.6.11 spec/tengine/job/examples_spec.rb
tengine_job-0.6.10 spec/tengine/job/examples_spec.rb
tengine_job-0.6.9 spec/tengine/job/examples_spec.rb