Sha256: b2307c92200e519eda33b96b625b33db64ef3e5396ccd2e3efb7e870f0a4199b

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require 'test_helper'

class CloudFormationProvisionerTest < Test::Unit::TestCase
  def setup
    @cf = CFStub.new
    @provisioner = EbDeployer::CloudFormationProvisioner.new("myresources", @cf)
    @template = sample_file("sample_template.json")
  end


  def test_convert_inputs_as_params_to_cf
    resources = { 'template' => @template, 'inputs' => { 'Foo' => 'Bar' } }
    @provisioner.provision(resources, [])

    assert_equal({ 'Foo' => 'Bar' }, @cf.stack_config("myresources")[:parameters])
  end

  def test_transform_to_eb_settings
    resources = { 'template' => @template,
      'outputs' => {
        'S' => {
          'namespace' => "foo",
          "option_name" => "bar"
        }
      }}

    @provisioner.provision(resources, [])
    settings = @provisioner.transform_outputs(resources)
    assert_equal [{'namespace' => 'foo', 'option_name' => 'bar', 'value' => 'value of S'}], settings
  end

  def test_stack_is_tagged
    resources = { 'template' => @template }

    @provisioner.provision(resources, [{key: 'Tag1', value: 'Value1'}])

    assert_equal([{key: 'Tag1', value: 'Value1'}], @cf.stack_config("myresources")[:tags])
  end

  def test_stack_is_not_tagged_when_no_tags_specified
    resources = { 'template' => @template }

    @provisioner.provision(resources, [])

    assert_equal([], @cf.stack_config("myresources")[:tags])
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
man_eb_deployer-0.8.0 test/cloud_formation_provisioner_test.rb
eb_deployer_updated-0.8.1 test/cloud_formation_provisioner_test.rb
eb_deployer_updated-0.8.0 test/cloud_formation_provisioner_test.rb