Sha256: 7072f9d830ffd0da82b1960b4fd0428b305af27a090675181dd0891db87e32b0

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require_relative './test_xml_generator'

class TestXmlConcurrent < Test::Unit::TestCase
  def test_concurrent_per_project
    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      concurrent do
        max_per_node 2
        max_total 0
      end
    end

    actual = builder.config_as_xml_node('foo')

    assert_equal 'true', actual.xpath('./project/concurrentBuild').text

    { 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
     'throttleOption' => 'project', 'configVersion' => '1' }.each do |k, v|
      assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
    end
  end

  def test_concurrent_per_category
    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      concurrent do
        max_per_node 2
        max_total 0
        category 'servicetest'
      end
    end

    actual = builder.config_as_xml_node('foo')

    assert_equal 'true', actual.xpath('./project/concurrentBuild').text

    { 'maxConcurrentPerNode' => '2', 'maxConcurrentTotal' => '0', 'throttleEnabled' => 'true',
     'throttleOption' => 'category', 'configVersion' => '1', 'categories/string' => 'servicetest' }.each do |k, v|
      assert_equal v, actual.xpath("./project/properties/hudson.plugins.throttleconcurrents.ThrottleJobProperty/#{k}").text, k
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubyjobbuilderdsl-0.0.8 test/test_concurrent.rb
rubyjobbuilderdsl-0.0.6 test/test_concurrent.rb
rubyjobbuilderdsl-0.0.4 test/test_concurrent.rb