Sha256: 571cef8c78fe4725b37a59a0c14120971467e147ee2c9d89a76eb1f980db8864

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/unittest_helper')

class TestJob < Test::Unit::TestCase
  def test_job_id
    job = Pmux::Job.new({}, [])
    assert_match /^\d+$/, job.id
  end

  def test_mk_tasks
    files = ['/tmp/f1', '/tmp/f2', '/tmp/f3']
    params = {}
    job = Pmux::Job.new params, files
    ae files.size, job.tasks.size
  end

  def test_mk_reducer_addrs
    job = Pmux::Job.new({}, [])

    # 1 node
    addrs = ['192.168.0.1']
    res = job.mk_reducer_addrs addrs, 1
    ae ['192.168.0.1'], res
    res = job.mk_reducer_addrs addrs, 3
    ae ['192.168.0.1', '192.168.0.1', '192.168.0.1'], res

    # 4 nodes
    addrs = ['192.168.0.1', '192.168.0.2', '192.168.0.3', '192.168.0.4']
    res = job.mk_reducer_addrs addrs, 1
    ae ['192.168.0.1'], res
    res = job.mk_reducer_addrs addrs, 2
    ae ['192.168.0.1', '192.168.0.3'], res
    res = job.mk_reducer_addrs addrs, 3
    ae ['192.168.0.1', '192.168.0.2', '192.168.0.3'], res
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pmux-0.1.3 test/test_job.rb
pmux-0.1.2 test/test_job.rb
pmux-0.1.1 test/test_job.rb
pmux-0.1.0 test/test_job.rb