Sha256: 7d8d54495da0a95691cc95096e61d80f25e4b008fbea449961cb520e5120a334

Contents?: true

Size: 1.68 KB

Versions: 7

Compression:

Stored size: 1.68 KB

Contents

require_relative 'test_helper'
require 'fileutils'

module Dynflow
  module WorldTest
    describe World do
      let(:world) { WorldFactory.create_world }
      let(:world_with_custom_meta) { WorldFactory.create_world { |c| c.meta = { 'fast' => true } } }

      describe '#meta' do
        it 'by default informs about the hostname and the pid running the world' do
          registered_world = world.coordinator.find_worlds(false, id: world.id).first
          registered_world.meta.must_equal('hostname' => Socket.gethostname, 'pid' => Process.pid)
        end

        it 'is configurable' do
          registered_world = world.coordinator.find_worlds(false, id: world_with_custom_meta.id).first
          registered_world.meta.must_equal('fast' => true)
        end
      end

      describe '#get_execution_status' do
        let(:base) do
          { :pool_size => 5, :free_workers => 5, :execution_status => {} }
        end

        it 'retrieves correct execution items count' do
          world.get_execution_status(world.id, nil, 5).value!.must_equal(base)
          id = 'something like uuid'
          expected = base.merge(:execution_status => { id => 0 })
          world.get_execution_status(world.id, id, 5).value!.must_equal(expected)
        end
      end

      describe '#terminate' do
        it 'fires an event after termination' do
          terminated_event = world.terminated
          terminated_event.completed?.must_equal false
          world.terminate
          # wait for termination process to finish, but don't block
          # the test from running.
          terminated_event.wait(10)
          terminated_event.completed?.must_equal true
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dynflow-0.8.37 test/world_test.rb
dynflow-0.8.36 test/world_test.rb
dynflow-0.8.35 test/world_test.rb
dynflow-0.8.34 test/world_test.rb
dynflow-0.8.33 test/world_test.rb
dynflow-0.8.32 test/world_test.rb
dynflow-0.8.31 test/world_test.rb