Sha256: 2120ec583d5d0c36cfacbe415a5dd8e5fd4560c2140f56cd16ee401070b50a68

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path('../../../test_helper', __FILE__)

class RestApiCartridgeTest < ActiveSupport::TestCase
  include RestApiAuth

  def setup
    with_configured_user
  end

  test 'cartridge scale parameters can be changed' do
    app = with_scalable_app

    carts = app.cartridges.select{ |c| c.scales? }
    assert_equal 1, carts.length

    cart = carts.first
    assert cart.tags.include? :web_framework
    assert cart.scales_from > 0
    assert cart.scales_to != 0
    assert cart.supported_scales_from > 0
    assert_equal(-1, cart.supported_scales_to)

    base = Range.new(cart.supported_scales_from, cart.supported_scales_to == -1 ? User.find(:one, :as => @user).max_gears : [100,cart.supported_scales_to].min).to_a.sample

    name = cart.name

    prefix = cart.prefix_options.dup

    cart.scales_from = base
    cart.scales_to = base
    assert cart.save, "Unable to set scales_from/to to #{base}: #{cart.errors.full_messages}"

    assert_equal base, cart.scales_from
    assert_equal base, cart.scales_to

    assert_equal prefix, cart.prefix_options

    cart.reload 

    assert_equal base, cart.scales_from
    assert_equal base, cart.scales_to

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openshift-origin-console-1.3.4 test/integration/rest_api/cartridge_test.rb
openshift-origin-console-1.3.3 test/integration/rest_api/cartridge_test.rb
openshift-origin-console-1.3.2 test/integration/rest_api/cartridge_test.rb