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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/stack_master/commands/terminal_helper.rb +14 -1
- data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
- data/lib/stack_master/version.rb +1 -1
- metadata +21 -216
- data/.gitignore +0 -18
- data/.rspec +0 -2
- data/.travis.yml +0 -12
- data/CODE_OF_CONDUCT.md +0 -73
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -27
- data/apply_demo.gif +0 -0
- data/example/simple/Gemfile +0 -3
- data/example/simple/parameters/myapp_vpc.yml +0 -1
- data/example/simple/parameters/myapp_web.yml +0 -2
- data/example/simple/stack_master.yml +0 -13
- data/example/simple/templates/myapp_vpc.rb +0 -39
- data/example/simple/templates/myapp_web.rb +0 -16
- data/features/apply.feature +0 -392
- data/features/apply_with_compile_time_parameters.feature +0 -93
- data/features/apply_with_env_parameters.feature +0 -49
- data/features/apply_with_parameter_store_parameters.feature +0 -47
- data/features/apply_with_s3.feature +0 -106
- data/features/delete.feature +0 -29
- data/features/diff.feature +0 -179
- data/features/events.feature +0 -33
- data/features/init.feature +0 -6
- data/features/outputs.feature +0 -45
- data/features/region_aliases.feature +0 -62
- data/features/resources.feature +0 -42
- data/features/stack_defaults.feature +0 -82
- data/features/status.feature +0 -118
- data/features/step_definitions/parameter_store_steps.rb +0 -14
- data/features/step_definitions/stack_steps.rb +0 -71
- data/features/support/env.rb +0 -16
- data/features/validate.feature +0 -46
- data/logo.png +0 -0
- data/script/buildkite/bundle.sh +0 -5
- data/script/buildkite/clean.sh +0 -3
- data/script/buildkite_rspec.sh +0 -27
- data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
- data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
- data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
- data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
- data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
- data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
- data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
- data/spec/fixtures/stack_master.yml +0 -49
- data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
- data/spec/fixtures/templates/myapp_vpc.json +0 -1
- data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
- data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
- data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
- data/spec/fixtures/test/.gitkeep +0 -0
- data/spec/spec_helper.rb +0 -102
- data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
- data/spec/stack_master/change_set_spec.rb +0 -70
- data/spec/stack_master/command_spec.rb +0 -66
- data/spec/stack_master/commands/apply_spec.rb +0 -259
- data/spec/stack_master/commands/delete_spec.rb +0 -40
- data/spec/stack_master/commands/init_spec.rb +0 -17
- data/spec/stack_master/commands/status_spec.rb +0 -44
- data/spec/stack_master/commands/validate_spec.rb +0 -27
- data/spec/stack_master/config_spec.rb +0 -153
- data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
- data/spec/stack_master/parameter_loader_spec.rb +0 -110
- data/spec/stack_master/parameter_resolver_spec.rb +0 -148
- data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
- data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
- data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
- data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
- data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
- data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
- data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
- data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
- data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
- data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
- data/spec/stack_master/prompter_spec.rb +0 -23
- data/spec/stack_master/resolver_array_spec.rb +0 -42
- data/spec/stack_master/security_group_finder_spec.rb +0 -49
- data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
- data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
- data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
- data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
- data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
- data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
- data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
- data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
- data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
- data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
- data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
- data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
- data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
- data/spec/stack_master/stack_definition_spec.rb +0 -70
- data/spec/stack_master/stack_differ_spec.rb +0 -46
- data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
- data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
- data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
- data/spec/stack_master/stack_spec.rb +0 -184
- data/spec/stack_master/template_compiler_spec.rb +0 -39
- data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
- data/spec/stack_master/template_compilers/json_spec.rb +0 -32
- data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
- data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
- data/spec/stack_master/template_utils_spec.rb +0 -21
- data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
- data/spec/stack_master/test_driver/s3_spec.rb +0 -17
- data/spec/stack_master/utils_spec.rb +0 -30
- data/spec/stack_master/validator_spec.rb +0 -56
- data/spec/stack_master_spec.rb +0 -81
- data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
- data/spec/support/validator_spec.rb +0 -23
- data/stack_master.gemspec +0 -46
- data/stacktemplates/parameter_region.yml +0 -3
- data/stacktemplates/parameter_stack_name.yml +0 -3
- data/stacktemplates/stack.json.erb +0 -20
- data/stacktemplates/stack_master.yml.erb +0 -6
data/features/support/env.rb
DELETED
@@ -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
|
data/features/validate.feature
DELETED
@@ -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
|
data/script/buildkite/bundle.sh
DELETED
data/script/buildkite/clean.sh
DELETED
data/script/buildkite_rspec.sh
DELETED
@@ -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 +0,0 @@
|
|
1
|
-
::SparkleFormation::SparklePack.register!
|
@@ -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,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"
|
data/spec/fixtures/test/.gitkeep
DELETED
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
|