stack_master 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/stack_master/commands/terminal_helper.rb +14 -1
  4. data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
  5. data/lib/stack_master/version.rb +1 -1
  6. metadata +21 -216
  7. data/.gitignore +0 -18
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -12
  10. data/CODE_OF_CONDUCT.md +0 -73
  11. data/Gemfile +0 -4
  12. data/LICENSE.txt +0 -22
  13. data/Rakefile +0 -27
  14. data/apply_demo.gif +0 -0
  15. data/example/simple/Gemfile +0 -3
  16. data/example/simple/parameters/myapp_vpc.yml +0 -1
  17. data/example/simple/parameters/myapp_web.yml +0 -2
  18. data/example/simple/stack_master.yml +0 -13
  19. data/example/simple/templates/myapp_vpc.rb +0 -39
  20. data/example/simple/templates/myapp_web.rb +0 -16
  21. data/features/apply.feature +0 -392
  22. data/features/apply_with_compile_time_parameters.feature +0 -93
  23. data/features/apply_with_env_parameters.feature +0 -49
  24. data/features/apply_with_parameter_store_parameters.feature +0 -47
  25. data/features/apply_with_s3.feature +0 -106
  26. data/features/delete.feature +0 -29
  27. data/features/diff.feature +0 -179
  28. data/features/events.feature +0 -33
  29. data/features/init.feature +0 -6
  30. data/features/outputs.feature +0 -45
  31. data/features/region_aliases.feature +0 -62
  32. data/features/resources.feature +0 -42
  33. data/features/stack_defaults.feature +0 -82
  34. data/features/status.feature +0 -118
  35. data/features/step_definitions/parameter_store_steps.rb +0 -14
  36. data/features/step_definitions/stack_steps.rb +0 -71
  37. data/features/support/env.rb +0 -16
  38. data/features/validate.feature +0 -46
  39. data/logo.png +0 -0
  40. data/script/buildkite/bundle.sh +0 -5
  41. data/script/buildkite/clean.sh +0 -3
  42. data/script/buildkite_rspec.sh +0 -27
  43. data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
  44. data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
  45. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
  46. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
  47. data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
  48. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
  49. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
  50. data/spec/fixtures/stack_master.yml +0 -49
  51. data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
  52. data/spec/fixtures/templates/myapp_vpc.json +0 -1
  53. data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
  54. data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
  55. data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
  56. data/spec/fixtures/test/.gitkeep +0 -0
  57. data/spec/spec_helper.rb +0 -102
  58. data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
  59. data/spec/stack_master/change_set_spec.rb +0 -70
  60. data/spec/stack_master/command_spec.rb +0 -66
  61. data/spec/stack_master/commands/apply_spec.rb +0 -259
  62. data/spec/stack_master/commands/delete_spec.rb +0 -40
  63. data/spec/stack_master/commands/init_spec.rb +0 -17
  64. data/spec/stack_master/commands/status_spec.rb +0 -44
  65. data/spec/stack_master/commands/validate_spec.rb +0 -27
  66. data/spec/stack_master/config_spec.rb +0 -153
  67. data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
  68. data/spec/stack_master/parameter_loader_spec.rb +0 -110
  69. data/spec/stack_master/parameter_resolver_spec.rb +0 -148
  70. data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
  71. data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
  72. data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
  73. data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
  74. data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
  75. data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
  76. data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
  77. data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
  78. data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
  79. data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
  80. data/spec/stack_master/prompter_spec.rb +0 -23
  81. data/spec/stack_master/resolver_array_spec.rb +0 -42
  82. data/spec/stack_master/security_group_finder_spec.rb +0 -49
  83. data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
  84. data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
  85. data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
  86. data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
  87. data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
  88. data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
  89. data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
  90. data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
  91. data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
  92. data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
  93. data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
  94. data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
  95. data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
  96. data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
  97. data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
  98. data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
  99. data/spec/stack_master/stack_definition_spec.rb +0 -70
  100. data/spec/stack_master/stack_differ_spec.rb +0 -46
  101. data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
  102. data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
  103. data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
  104. data/spec/stack_master/stack_spec.rb +0 -184
  105. data/spec/stack_master/template_compiler_spec.rb +0 -39
  106. data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
  107. data/spec/stack_master/template_compilers/json_spec.rb +0 -32
  108. data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
  109. data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
  110. data/spec/stack_master/template_utils_spec.rb +0 -21
  111. data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
  112. data/spec/stack_master/test_driver/s3_spec.rb +0 -17
  113. data/spec/stack_master/utils_spec.rb +0 -30
  114. data/spec/stack_master/validator_spec.rb +0 -56
  115. data/spec/stack_master_spec.rb +0 -81
  116. data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
  117. data/spec/support/validator_spec.rb +0 -23
  118. data/stack_master.gemspec +0 -46
  119. data/stacktemplates/parameter_region.yml +0 -3
  120. data/stacktemplates/parameter_stack_name.yml +0 -3
  121. data/stacktemplates/stack.json.erb +0 -20
  122. data/stacktemplates/stack_master.yml.erb +0 -6
@@ -1,16 +0,0 @@
1
- require 'aruba/cucumber'
2
- require 'stack_master'
3
- require 'stack_master/testing'
4
- require 'aruba/in_process'
5
- require 'pry'
6
- require 'cucumber/rspec/doubles'
7
-
8
- Aruba.configure do |config|
9
- config.command_launcher = :in_process
10
- config.main_class = StackMaster::CLI
11
- end
12
-
13
- Before do
14
- StackMaster.cloud_formation_driver.reset
15
- StackMaster.s3_driver.reset
16
- end
@@ -1,46 +0,0 @@
1
- Feature: Validate command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- stack1:
9
- template: stack1.json
10
- """
11
- And a directory named "parameters"
12
- And a file named "parameters/stack1.yml" with:
13
- """
14
- InstanceTypeParameter: my-type
15
- """
16
- And a directory named "templates"
17
- And a file named "templates/stack1.json" with:
18
- """
19
- {
20
- "AWSTemplateFormatVersion": "2010-09-09",
21
- "Description": "Test template",
22
- "Parameters": {
23
- "InstanceTypeParameter" : { "Type" : "String" }
24
- },
25
- "Mappings": {},
26
- "Resources": {
27
- "MyAwesomeQueue" : {
28
- "Type" : "AWS::SQS::Queue",
29
- "Properties" : {
30
- "VisibilityTimeout" : "1"
31
- }
32
- }
33
- },
34
- "Outputs": {}
35
- }
36
- """
37
-
38
- Scenario: Validate successfully
39
- Given I stub CloudFormation validate calls to pass validation
40
- And I run `stack_master validate us-east-1 stack1`
41
- Then the output should contain "stack1: valid"
42
-
43
- Scenario: Validate unsuccessfully
44
- Given I stub CloudFormation validate calls to fail validation with message "Blah"
45
- And I run `stack_master validate us-east-1 stack1`
46
- Then the output should contain "stack1: invalid. Blah"
data/logo.png DELETED
Binary file
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e -x
4
-
5
- bundle check || bundle --binstubs bin --path .bundle --without darwin,debugger,development
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- git clean -fd
@@ -1,27 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- echo
6
- echo "--- Cleaning up working tree"
7
- echo
8
-
9
- time ./script/buildkite/clean.sh
10
-
11
- echo
12
- echo "--- Bundling"
13
- echo
14
-
15
- time ./script/buildkite/bundle.sh
16
-
17
- echo
18
- echo "+++ Running rspec"
19
- echo
20
-
21
- time bundle exec rspec
22
-
23
- echo
24
- echo "+++ Running cucumber"
25
- echo
26
-
27
- time bundle exec cucumber
@@ -1 +0,0 @@
1
- param_1: 'hello'
@@ -1,3 +0,0 @@
1
- param_1: 'hello'
2
- param_2:
3
- secret: world
@@ -1 +0,0 @@
1
- ::SparkleFormation::SparklePack.register!
@@ -1,5 +0,0 @@
1
- SparkleFormation.dynamic(:my_dynamic) do
2
- outputs.foo do
3
- value "bar"
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- SparkleFormation.dynamic(:local_dynamic) do
2
- outputs.bar do
3
- value "local_dynamic"
4
- end
5
- end
@@ -1,3 +0,0 @@
1
- SparkleFormation.new(:template_with_dynamic) do
2
- dynamic!(:local_dynamic)
3
- end
@@ -1,3 +0,0 @@
1
- SparkleFormation.new(:template_with_dynamic_from_pack) do
2
- dynamic!(:my_dynamic)
3
- end
@@ -1,49 +0,0 @@
1
- region_aliases:
2
- production: us-east-1
3
- staging: ap-southeast-2
4
- stack_defaults:
5
- tags:
6
- application: my-awesome-blog
7
- s3:
8
- bucket: my-bucket
9
- region: us-east-1
10
- template_compilers:
11
- rb: ruby_dsl
12
- region_defaults:
13
- us_east_1:
14
- tags:
15
- environment: production
16
- notification_arns:
17
- - test_arn
18
- role_arn: test_service_role_arn
19
- secret_file: production.yml.gpg
20
- stack_policy_file: my_policy.json
21
- staging:
22
- tags:
23
- environment: staging
24
- test_override: 1
25
- notification_arns:
26
- - test_arn_3
27
- role_arn: test_service_role_arn3
28
- secret_file: staging.yml.gpg
29
- stacks:
30
- us-east-1:
31
- myapp_vpc:
32
- template: myapp_vpc.json
33
- notification_arns:
34
- - test_arn_2
35
- role_arn: test_service_role_arn2
36
- myapp_web:
37
- template: myapp_web.rb
38
- myapp_vpc_with_secrets:
39
- template: myapp_vpc.json
40
- ap-southeast-2:
41
- myapp_vpc:
42
- template: myapp_vpc.rb
43
- notification_arns:
44
- - test_arn_4
45
- role_arn: test_service_role_arn4
46
- myapp_web:
47
- template: myapp_web
48
- tags:
49
- test_override: 2
@@ -1,53 +0,0 @@
1
- {
2
- "Description": "A test VPC template",
3
- "Resources": {
4
- "Vpc": {
5
- "Type": "AWS::EC2::VPC",
6
- "Properties": {
7
- "CidrBlock": "10.200.0.0/16"
8
- }
9
- },
10
- "PublicSubnet": {
11
- "Type": "AWS::EC2::Subnet",
12
- "Properties": {
13
- "VpcId": {
14
- "Ref": "Vpc"
15
- },
16
- "CidrBlock": "10.200.1.0/24",
17
- "AvailabilityZone": {
18
- "Ref": "VpcAz1"
19
- },
20
- "Tags": [
21
- {
22
- "Key": "Name",
23
- "Value": "PublicSubnet"
24
- },
25
- {
26
- "Key": "network",
27
- "Value": "public"
28
- }
29
- ]
30
- }
31
- }
32
- },
33
- "Parameters": {
34
- "VpcAz1": {
35
- "Description": "VPC AZ 1",
36
- "Type": "AWS::EC2::AvailabilityZone::Name"
37
- }
38
- },
39
- "Outputs": {
40
- "VpcId": {
41
- "Description": "VPC ID",
42
- "Value": {
43
- "Ref": "Vpc"
44
- }
45
- },
46
- "PublicSubnet": {
47
- "Description": "Public subnet",
48
- "Value": {
49
- "Ref": "PublicSubnet"
50
- }
51
- }
52
- }
53
- }
@@ -1 +0,0 @@
1
- {}
@@ -1,28 +0,0 @@
1
- {
2
- "Parameters" : {
3
- "One" : {
4
- "Type" : "String",
5
- "Default" : "Test",
6
- "MaxLength" : 15
7
- }
8
- },
9
- "Resources" : {
10
- "MyInstance" : {
11
- "Type" : "AWS::EC2::Instance",
12
- "Properties" : {
13
- "ImageId" : "ami-12345678"
14
- }
15
- }
16
- },
17
- "AWSTemplateFormatVersion" : "2010-09-09",
18
- "Outputs" : {
19
- "One" : {
20
- "Value" : {
21
- "Fn::Base64" : {
22
- "Ref" : "One"
23
- }
24
- }
25
- }
26
- },
27
- "Description" : "Test"
28
- }
@@ -1,16 +0,0 @@
1
- CloudFormation {
2
- Description "Test"
3
-
4
- Parameter("One") {
5
- String
6
- Default "Test"
7
- MaxLength 15
8
- }
9
-
10
- Output(:One,FnBase64( Ref("One")))
11
-
12
- EC2_Instance(:MyInstance) {
13
- ImageId "ami-12345678"
14
- }
15
-
16
- }
@@ -1,35 +0,0 @@
1
- ---
2
- Description: "A test VPC template"
3
- Resources:
4
- Vpc:
5
- Type: "AWS::EC2::VPC"
6
- Properties:
7
- CidrBlock: "10.200.0.0/16"
8
- PublicSubnet:
9
- Type: "AWS::EC2::Subnet"
10
- Properties:
11
- VpcId:
12
- Ref: "Vpc"
13
- CidrBlock: "10.200.1.0/24"
14
- AvailabilityZone:
15
- Ref: "VpcAz1"
16
- Tags:
17
- -
18
- Key: "Name"
19
- Value: "PublicSubnet"
20
- -
21
- Key: "network"
22
- Value: "public"
23
- Parameters:
24
- VpcAz1:
25
- Description: "VPC AZ 1"
26
- Type: "AWS::EC2::AvailabilityZone::Name"
27
- Outputs:
28
- VpcId:
29
- Description: "VPC ID"
30
- Value:
31
- Ref: "Vpc"
32
- PublicSubnet:
33
- Description: "Public subnet"
34
- Value:
35
- Ref: "PublicSubnet"
File without changes
data/spec/spec_helper.rb DELETED
@@ -1,102 +0,0 @@
1
- require 'stack_master'
2
- require 'timecop'
3
- require 'pry'
4
-
5
- Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
6
-
7
- Aws.config[:stub_responses] = true
8
- # This file was generated by the `rspec --init` command. Conventionally, all
9
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
10
- # The generated `.rspec` file contains `--require spec_helper` which will cause
11
- # this file to always be loaded, without a need to explicitly require it in any
12
- # files.
13
- #
14
- # Given that it is always loaded, you are encouraged to keep this file as
15
- # light-weight as possible. Requiring heavyweight dependencies from this file
16
- # will add to the boot time of your test suite on EVERY test run, even for an
17
- # individual file that may not need all of that loaded. Instead, consider making
18
- # a separate helper file that requires the additional dependencies and performs
19
- # the additional setup, and require it from the spec files that actually need
20
- # it.
21
- #
22
- # The `.rspec` file also contains a few flags that are not defaults but that
23
- # users commonly want.
24
- #
25
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
26
- RSpec.configure do |config|
27
- config.before do
28
- StackMaster.cloud_formation_driver = nil
29
- end
30
- # rspec-expectations config goes here. You can use an alternate
31
- # assertion/expectation library such as wrong or the stdlib/minitest
32
- # assertions if you prefer.
33
- config.expect_with :rspec do |expectations|
34
- # This option will default to `true` in RSpec 4. It makes the `description`
35
- # and `failure_message` of custom matchers include text for helper methods
36
- # defined using `chain`, e.g.:
37
- # be_bigger_than(2).and_smaller_than(4).description
38
- # # => "be bigger than 2 and smaller than 4"
39
- # ...rather than:
40
- # # => "be bigger than 2"
41
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
- end
43
-
44
- # rspec-mocks config goes here. You can use an alternate test double
45
- # library (such as bogus or mocha) by changing the `mock_with` option here.
46
- config.mock_with :rspec do |mocks|
47
- # Prevents you from mocking or stubbing a method that does not exist on
48
- # a real object. This is generally recommended, and will default to
49
- # `true` in RSpec 4.
50
- mocks.verify_partial_doubles = true
51
- end
52
-
53
- # These two settings work together to allow you to limit a spec run
54
- # to individual examples or groups you care about by tagging them with
55
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
- # get run.
57
- config.filter_run :focus
58
- config.run_all_when_everything_filtered = true
59
-
60
- # Allows RSpec to persist some state between runs in order to support
61
- # the `--only-failures` and `--next-failure` CLI options. We recommend
62
- # you configure your source control system to ignore this file.
63
- config.example_status_persistence_file_path = "spec/examples.txt"
64
-
65
- # Limits the available syntax to the non-monkey patched syntax that is
66
- # recommended. For more details, see:
67
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
68
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
69
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
70
- config.disable_monkey_patching!
71
-
72
- # This setting enables warnings. It's recommended, but in some cases may
73
- # be too noisy due to issues in dependencies.
74
- # config.warnings = true
75
-
76
- # Many RSpec users commonly either run the entire suite or an individual
77
- # file, and it's useful to allow more verbose output when running an
78
- # individual spec file.
79
- if config.files_to_run.one?
80
- # Use the documentation formatter for detailed output,
81
- # unless a formatter has already been configured
82
- # (e.g. via a command-line flag).
83
- config.default_formatter = 'doc'
84
- end
85
-
86
- # Print the 10 slowest examples and example groups at the
87
- # end of the spec run, to help surface which specs are running
88
- # particularly slow.
89
- config.profile_examples = 10
90
-
91
- # Run specs in random order to surface order dependencies. If you find an
92
- # order dependency and want to debug it, you can fix the order by providing
93
- # the seed, which is printed after each run.
94
- # --seed 1234
95
- config.order = :random
96
-
97
- # Seed global randomization in this process using the `--seed` CLI option.
98
- # Setting this allows you to use `--seed` to deterministically reproduce
99
- # test failures related to randomization by passing the same `--seed` value
100
- # as the one that triggered the failure.
101
- Kernel.srand config.seed
102
- end
@@ -1,130 +0,0 @@
1
- RSpec.describe StackMaster::AwsDriver::S3 do
2
- let(:region) { 'us-east-1' }
3
- let(:bucket) { 'bucket' }
4
- let(:s3) { Aws::S3::Client.new(stub_responses: true) }
5
- subject(:s3_driver) { StackMaster::AwsDriver::S3.new }
6
-
7
- before do
8
- allow(Aws::S3::Client).to receive(:new).and_return(s3)
9
- end
10
-
11
- describe '#upload_files' do
12
- before do
13
- allow(File).to receive(:read).and_return('file content')
14
- end
15
-
16
- context 'when set_region is called' do
17
- it 'defaults to that region' do
18
- s3_driver.set_region('default')
19
- expect(Aws::S3::Client).to receive(:new).with(region: 'default').and_return(s3)
20
- files = {
21
- 'template' => {
22
- path: 'spec/fixtures/templates/myapp_vpc.json',
23
- body: 'file content'
24
- }
25
- }
26
- s3_driver.upload_files(bucket: 'b',
27
- files: files)
28
- end
29
- end
30
-
31
- context 'when called with a prefix' do
32
- let(:options) do
33
- {
34
- bucket: 'bucket',
35
- region: 'region',
36
- prefix: 'prefix',
37
- files: {'template' => {
38
- path: 'spec/fixtures/templates/myapp_vpc.json',
39
- body: 'file content'
40
- }
41
- }
42
- }
43
- end
44
-
45
- it 'uploads files under a prefix' do
46
- expect(s3).to receive(:put_object).with(bucket: 'bucket',
47
- key: 'prefix/template',
48
- body: 'file content',
49
- metadata: {md5: "d10b4c3ff123b26dc068d43a8bef2d23"})
50
- s3_driver.upload_files(options)
51
- end
52
- end
53
-
54
- context 'when called without a prefix' do
55
- let(:options) do
56
- {
57
- bucket: 'bucket',
58
- region: 'region',
59
- files: {'template' => {
60
- :path => 'spec/fixtures/templates/myapp_vpc.json',
61
- :body => 'file content'
62
- }
63
- }
64
- }
65
- end
66
-
67
- it 'uploads files under the bucket root' do
68
- expect(s3).to receive(:put_object).with(bucket: 'bucket',
69
- key: 'template',
70
- body: 'file content',
71
- metadata: {md5: "d10b4c3ff123b26dc068d43a8bef2d23"})
72
- s3_driver.upload_files(options)
73
- end
74
- end
75
-
76
- context 'when called with files in a subfolder' do
77
- let(:options) do
78
- {
79
- bucket: 'bucket',
80
- region: 'region',
81
- prefix: 'prefix',
82
- files: {'template' => {
83
- :path => 'spec/fixtures/templates/myapp_vpc.json',
84
- :body => 'file content'
85
- }
86
- }
87
- }
88
- end
89
-
90
- it 'uploads files under the prefix' do
91
- expect(s3).to receive(:put_object).with(bucket: 'bucket',
92
- key: 'prefix/template',
93
- body: 'file content',
94
- metadata: {md5: "d10b4c3ff123b26dc068d43a8bef2d23"})
95
- s3_driver.upload_files(options)
96
- end
97
- end
98
-
99
- context 'when called with several files' do
100
- let(:options) do
101
- {
102
- bucket: 'bucket',
103
- region: 'region',
104
- files: {
105
- 'template1' => {
106
- :path => 'spec/fixtures/templates/myapp_vpc.json',
107
- :body => 'file content'
108
- },
109
- 'template2' => {
110
- :path => 'spec/fixtures/templates/myapp_vpc.json',
111
- :body => 'file content'
112
- }
113
- }
114
- }
115
- end
116
-
117
- it 'uploads all the files' do
118
- expect(s3).to receive(:put_object).with(bucket: 'bucket',
119
- key: 'template1',
120
- body: 'file content',
121
- metadata: {md5: "d10b4c3ff123b26dc068d43a8bef2d23"})
122
- expect(s3).to receive(:put_object).with(bucket: 'bucket',
123
- key: 'template2',
124
- body: 'file content',
125
- metadata: {md5: "d10b4c3ff123b26dc068d43a8bef2d23"})
126
- s3_driver.upload_files(options)
127
- end
128
- end
129
- end
130
- end