aws-must-templates 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -29
- data/spec/aws-must-templates/AwsCommandLineInterfaceInstalled/AwsCommandLineInterfaceInstalled_spec.rb +10 -0
- data/spec/aws-must-templates/AwsMustTestRunnerProperties/AwsMustTestRunnerProperties_spec.rb +39 -0
- data/spec/aws-must-templates/CloudFormationHelperScriptsInstalled/CloudFormationHelperScriptsInstalled_spec.rb +21 -0
- data/spec/aws-must-templates/ParameterTest/ParameterTest_spec.rb +35 -0
- data/spec/aws-must-templates/S3NoAccess/S3NoAccess_spec.rb +72 -0
- data/spec/aws-must-templates/S3ReadAccessAllowed/S3ReadAccessAllowed_spec.rb +144 -0
- data/spec/aws-must-templates/Stack/Stack_spec.rb +49 -0
- data/spec/aws-must-templates/ValidOSVersion/ValidOSVersion_spec.rb +16 -0
- data/spec/lib/rspec_spec.rb +8 -0
- data/spec/lib/spec_helper.rb +1 -0
- data/spec/lib/test_suites_spec.rb +343 -0
- data/spec/mustache/commonCfnSignal_spec.rb +46 -0
- data/spec/mustache/commonCreationPolicy_spec.rb +58 -0
- data/spec/mustache/commonDependsOn_spec.rb +52 -0
- data/spec/mustache/commonInstanceType_spec.rb +75 -0
- data/spec/mustache/commonKeyValue_spec.rb +60 -0
- data/spec/mustache/commonStackRef_spec.rb +55 -0
- data/spec/mustache/commonValue_spec.rb +77 -0
- data/spec/mustache/initializeCFinit_spec.rb +38 -0
- data/spec/mustache/initializeCFtools_spec.rb +41 -0
- data/spec/mustache/initializeCfnInitHupFiles_spec.rb +105 -0
- data/spec/mustache/initializeInstallAwsCli_spec.rb +41 -0
- data/spec/mustache/initializeInstallChef_spec.rb +40 -0
- data/spec/mustache/initializeProvisionChefZero_spec.rb +40 -0
- data/spec/mustache/initializeStartCfnHup_spec.rb +37 -0
- data/spec/mustache/mappingSubnetConfig_spec.rb +45 -0
- data/spec/mustache/mapping_spec.rb +43 -0
- data/spec/mustache/mappings_spec.rb +42 -0
- data/spec/mustache/output_spec.rb +84 -0
- data/spec/mustache/parameter_spec.rb +46 -0
- data/spec/mustache/resourceInstanceInitialize_spec.rb +158 -0
- data/spec/mustache/resourceInstanceMetadata_spec.rb +85 -0
- data/spec/mustache/resourceInstanceProfile_spec.rb +55 -0
- data/spec/mustache/resourceInstance_spec.rb +51 -0
- data/spec/mustache/resourceInternetGateway_spec.rb +94 -0
- data/spec/mustache/resourcePolicy_spec.rb +107 -0
- data/spec/mustache/resourceProvisionChef_spec.rb +44 -0
- data/spec/mustache/resourceRole_spec.rb +66 -0
- data/spec/mustache/resourceS3Bucket_spec.rb +58 -0
- data/spec/mustache/resourceSecurityGroup_spec.rb +60 -0
- data/spec/mustache/resourceStack_spec.rb +60 -0
- data/spec/mustache/resourceSubnet_spec.rb +55 -0
- data/spec/mustache/resourceUser_spec.rb +67 -0
- data/spec/mustache/resourceVPC_spec.rb +57 -0
- data/spec/mustache/resourceWait_spec.rb +78 -0
- data/spec/mustache/resource_spec.rb +382 -0
- data/spec/mustache/resources_spec.rb +46 -0
- data/spec/mustache/root_spec.rb +165 -0
- data/spec/mustache/rspec_spec.rb +9 -0
- data/spec/mustache/spec_helper.rb +36 -0
- data/spec/mustache/tag_spec.rb +46 -0
- data/spec/support/lib/stack_output.rb +31 -0
- data/spec/support/lib/stack_parameter.rb +32 -0
- data/spec/support/lib/test_parameter.rb +64 -0
- data/spec/support/lib/valid_property.rb +63 -0
- data/spec/support/spec_helper.rb +134 -0
- data/spec/support/utils.rb +6 -0
- metadata +61 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecd754daf7d055170eebd8f71822e307d16bc46b
|
|
4
|
+
data.tar.gz: 26abbd64a494b9bd110404d5e6ee12665d55de48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b2d31cc6043c8980ae42827ffb0f5bfba188ab84fa74d294c01eaa1a3bde46dc213639d6942a204a786fc4f819b0353cb5ce88756100360274360a61b051ba8
|
|
7
|
+
data.tar.gz: 0ae4e92ade9306216892a408a71a4cf599c696cf6d934ac946bc401fef20d9d8fd48e8046356ec095f918d0fffc3391fe9e209273293cacae14ca31445293e61
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# aws-must-templates - cloudformation templates for aws-must - $Release:0.1.
|
|
1
|
+
# aws-must-templates - cloudformation templates for aws-must - $Release:0.1.3$
|
|
2
2
|
|
|
3
3
|
Set of [extensible](#OVERRIDE)
|
|
4
4
|
[templates](https://rawgit.com/jarjuk/aws-must-templates/master/generated-docs/aws-must-templates.html)
|
|
@@ -181,25 +181,23 @@ To use the **aws-must-templates** Test Runner
|
|
|
181
181
|
|
|
182
182
|
### Setup for Test Runner<a id="SETUP-TEST-RUNNER"/>
|
|
183
183
|
|
|
184
|
-
Ensure that `Gemfile` includes
|
|
185
|
-
|
|
186
|
-
gem 'rake'
|
|
187
|
-
gem 'rspec'
|
|
188
|
-
gem 'serverspec'
|
|
189
|
-
gem 'aws-must-templates'
|
|
190
|
-
|
|
191
|
-
Run `bundle install`, if new gems were added to the `Gemfile`.
|
|
192
|
-
|
|
193
184
|
Add following lines to `Rakefile`
|
|
194
185
|
|
|
195
186
|
spec = Gem::Specification.find_by_name 'aws-must-templates'
|
|
196
187
|
load "#{spec.gem_dir}/lib/tasks/suite.rake"
|
|
197
188
|
|
|
189
|
+
create an empty `test-suites.yaml` -file
|
|
190
|
+
|
|
191
|
+
touch test-suites.yaml
|
|
192
|
+
|
|
198
193
|
and run
|
|
199
194
|
|
|
200
195
|
bundle exec rake -T suite
|
|
201
196
|
|
|
202
|
-
|
|
197
|
+
For an empty test-suites.yaml the result shows
|
|
198
|
+
|
|
199
|
+
rake suite:all[gen_opts] # Run all suites
|
|
200
|
+
|
|
203
201
|
|
|
204
202
|
### Prepare Test Context <a id="TEST-CONTEXT"/>
|
|
205
203
|
|
|
@@ -263,29 +261,30 @@ with the code shown:
|
|
|
263
261
|
end
|
|
264
262
|
|
|
265
263
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
[
|
|
269
|
-
|
|
264
|
+
For more information on Test Cases, see
|
|
265
|
+
[test report](generated-docs/test-suites.md) created, when running
|
|
266
|
+
[test-suites](test-suites.yaml) in **aws-must-templates** development,
|
|
267
|
+
and a [diagram](generated-docs/xref_suite_X_test.pdf) for an overview.
|
|
268
|
+
|
|
270
269
|
|
|
271
270
|
### Configure Test Suites <a id="TEST-SUITES"/>
|
|
272
271
|
|
|
273
|
-
Test
|
|
274
|
-
this file in current working directory.
|
|
272
|
+
Test Suites are configured in `test-suites.yaml`. Test Runner searches
|
|
273
|
+
this file in current working directory.
|
|
275
274
|
|
|
276
275
|
The picture below present main elements used in `test-suites.yaml`.
|
|
277
276
|
|
|
278
277
|

|
|
279
278
|
|
|
280
|
-
A Test Suite validates
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
A Test Suite validates correctness of a CloudFormation Stack. One Test
|
|
280
|
+
Suite defines tests for multiple EC2 Instances. Each EC2 Instance must
|
|
281
|
+
have a corresponding SSH Connection prepared in
|
|
283
282
|
[ssh/config](#TEST-CONTEXT) -file. An EC2 Instance acts in many
|
|
284
283
|
Roles. A Role maps to a [Test Case](#TEST_CASES), and and defines
|
|
285
284
|
values for the Test Case Parameters. The parameter may be a constant,
|
|
286
285
|
or a reference to Stack Parameter, or to Stack Output.
|
|
287
286
|
|
|
288
|
-
|
|
287
|
+
As an example, the Test Suite for `mystack` is
|
|
289
288
|
|
|
290
289
|
- mystack:
|
|
291
290
|
desc: Copy of suite1 EC2 instance with s3 access
|
|
@@ -297,22 +296,22 @@ An example Test Case for `mystack` is shown below
|
|
|
297
296
|
- S3ReadAccessAllowed:
|
|
298
297
|
Bucket: "@Outputs.Bucket"
|
|
299
298
|
|
|
300
|
-
|
|
299
|
+
The Suite validates stack `mystack` by running two Test Cases
|
|
301
300
|
`ValidOSVersion` and `S3ReadAccessAllowed` on EC2 instance
|
|
302
301
|
`myInstance`.
|
|
303
302
|
|
|
304
|
-
Test Case ValidOSVersion was presented [earlier](#TEST_CASES). It
|
|
305
|
-
parameter `Codename` to validate operating system version. In
|
|
306
|
-
configuration, the parameter value is constant
|
|
307
|
-
this validates that CloudFormation mapping used
|
|
308
|
-
[override](#OVERRIDE) the default implementation in
|
|
303
|
+
Test Case `ValidOSVersion` was presented [earlier](#TEST_CASES). It
|
|
304
|
+
uses parameter `Codename` to validate operating system version. In
|
|
305
|
+
this configuration, the parameter value is constant
|
|
306
|
+
`utopic`. Effectively this validates that CloudFormation mapping used
|
|
307
|
+
to [override](#OVERRIDE) the default implementation in
|
|
309
308
|
**aws-must-templates** is successfully provisioned.
|
|
310
309
|
|
|
311
310
|
Test Case `S3ReadAccessAllowed` is passed a parameter, which gets its
|
|
312
311
|
value from stack output variable `Bucket`.
|
|
313
312
|
|
|
314
|
-
See [test-suites.yaml](test-suites.yaml) in **aws-must-
|
|
315
|
-
|
|
313
|
+
See [test-suites.yaml](test-suites.yaml) in **aws-must-templates** for
|
|
314
|
+
a more detailed explanation, and for more examples.
|
|
316
315
|
|
|
317
316
|
### Running test suites <a id="RUN-TESTS"/>
|
|
318
317
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# ------------------------------------------------------------------
|
|
6
|
+
# Configuration
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
current_test = "AwsMustTestRunnerProperties"
|
|
10
|
+
|
|
11
|
+
# every suite should define these paramentes
|
|
12
|
+
system_properties = [
|
|
13
|
+
[:stack_id ],
|
|
14
|
+
[:suite_id ],
|
|
15
|
+
["Outputs" ],
|
|
16
|
+
["Parameters" ],
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
# ------------------------------------------------------------------
|
|
20
|
+
#
|
|
21
|
+
|
|
22
|
+
describe current_test do
|
|
23
|
+
|
|
24
|
+
# ------------------------------------------------------------------
|
|
25
|
+
#
|
|
26
|
+
describe "System properties" do
|
|
27
|
+
|
|
28
|
+
system_properties.each do | keys |
|
|
29
|
+
|
|
30
|
+
describe valid_property( keys ) do
|
|
31
|
+
its( :value ) { should_not eq nil }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "CloudFormationHelperScriptsInstalled" do
|
|
4
|
+
|
|
5
|
+
describe command('type cfn-init') do
|
|
6
|
+
its( :exit_status ) { should eq 0 }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe command('type cfn-signal') do
|
|
10
|
+
its( :exit_status ) { should eq 0 }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe command('type cfn-get-metadata') do
|
|
14
|
+
its( :exit_status ) { should eq 0 }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe command('type cfn-hup') do
|
|
18
|
+
its( :exit_status ) { should eq 0 }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
current_test = "ParameterTest"
|
|
5
|
+
|
|
6
|
+
describe current_test do |ex|
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# ------------------------------------------------------------------
|
|
10
|
+
# test parameters
|
|
11
|
+
parameter1 = test_parameter( current_test, "param1" )
|
|
12
|
+
parameter2 = test_parameter( current_test, "param2" )
|
|
13
|
+
parameter3 = test_parameter( current_test, "param3" )
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# ------------------------------------------------------------------
|
|
17
|
+
# Test paramters defined
|
|
18
|
+
|
|
19
|
+
describe "Test parameter definition" do
|
|
20
|
+
|
|
21
|
+
describe parameter1 do
|
|
22
|
+
its( :definition_in_test_suite ) { should_not eq nil }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe parameter2 do
|
|
26
|
+
its( :definition_in_test_suite ) { should_not eq nil }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe parameter3 do
|
|
30
|
+
its( :definition_in_test_suite ) { should_not eq nil }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end # describe "Test parameters" do
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# ------------------------------------------------------------------
|
|
4
|
+
# config
|
|
5
|
+
|
|
6
|
+
current_test = "S3NoAccess"
|
|
7
|
+
|
|
8
|
+
# ------------------------------------------------------------------
|
|
9
|
+
# Tests
|
|
10
|
+
|
|
11
|
+
describe current_test do
|
|
12
|
+
|
|
13
|
+
# ------------------------------------------------------------------
|
|
14
|
+
# test parameters
|
|
15
|
+
|
|
16
|
+
bucket_name = test_parameter( current_test, "Bucket" )
|
|
17
|
+
|
|
18
|
+
# ------------------------------------------------------------------
|
|
19
|
+
# Context NO access granted
|
|
20
|
+
|
|
21
|
+
context "When Bucket exists" do
|
|
22
|
+
|
|
23
|
+
before(:all) do
|
|
24
|
+
cmd = "aws s3 ls s3://#{bucket_name.value}"
|
|
25
|
+
`#{cmd}`
|
|
26
|
+
raise "Error in '#{cmd}' " unless $? == 0
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "#cannot list Bucket" do
|
|
30
|
+
describe command('aws s3 ls') do
|
|
31
|
+
its( :exit_status ) { should_not eq 0 }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test_file="ttest22.tmp"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
context "When Object exists in Bucket" do
|
|
39
|
+
|
|
40
|
+
# File copy succeed --> bucket exists
|
|
41
|
+
before() do
|
|
42
|
+
cmd = "echo tst | aws s3 cp - s3://#{bucket_name.value}/#{test_file}"
|
|
43
|
+
`#{cmd}`
|
|
44
|
+
raise "Error in '#{cmd}' " unless $? == 0
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
after(:all) do
|
|
48
|
+
cmd = "aws s3 rm s3://#{bucket_name.value}/#{test_file}"
|
|
49
|
+
`#{cmd}`
|
|
50
|
+
raise "Error in '#{cmd}' " unless $? == 0
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe "#cannot list S3 bucket keys" do
|
|
54
|
+
describe command( "aws s3 ls s3://#{bucket_name.value} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)") do
|
|
55
|
+
its( :exit_status ) { should_not eq 0 }
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "#cannot cp S3 bucket object" do
|
|
60
|
+
describe command("aws s3 cp s3://#{bucket_name.value}/#{test_file} /tmp/#{test_file} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)") do
|
|
61
|
+
its( :exit_status ) { should_not eq 0 }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end # conttext
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
current_test = "S3ReadAccessAllowed"
|
|
4
|
+
|
|
5
|
+
describe current_test do
|
|
6
|
+
|
|
7
|
+
# ------------------------------------------------------------------
|
|
8
|
+
# test parameters
|
|
9
|
+
|
|
10
|
+
bucket_name = test_parameter( current_test, "Bucket" )
|
|
11
|
+
|
|
12
|
+
# bucket_name = stack_output( 'Bucket' ).value
|
|
13
|
+
|
|
14
|
+
# ------------------------------------------------------------------
|
|
15
|
+
# constanst used in test
|
|
16
|
+
|
|
17
|
+
test_file="ttest.tmp"
|
|
18
|
+
|
|
19
|
+
# ------------------------------------------------------------------
|
|
20
|
+
# Test paramters defined
|
|
21
|
+
|
|
22
|
+
describe "Test parameter definition" do
|
|
23
|
+
|
|
24
|
+
describe bucket_name do
|
|
25
|
+
its( :definition_in_test_suite ) { should_not eq nil }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe "Test parameter values" do
|
|
31
|
+
|
|
32
|
+
describe bucket_name do
|
|
33
|
+
its( :value ) { should_not eq nil }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# # ------------------------------------------------------------------
|
|
40
|
+
# # Stack parameters && outputs
|
|
41
|
+
|
|
42
|
+
# describe "Stack" do
|
|
43
|
+
|
|
44
|
+
# it "#defines bucket_name" do
|
|
45
|
+
# expect( bucket_name ).not_to eql( nil )
|
|
46
|
+
# end
|
|
47
|
+
|
|
48
|
+
# end
|
|
49
|
+
|
|
50
|
+
# ------------------------------------------------------------------
|
|
51
|
+
# aws Command line interface installed
|
|
52
|
+
|
|
53
|
+
context "Operating system context" do
|
|
54
|
+
|
|
55
|
+
describe "Aws Commad Line Interface (CLI) is installed" do
|
|
56
|
+
describe command('type aws') do
|
|
57
|
+
its( :exit_status ) { should eq 0 }
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# ------------------------------------------------------------------
|
|
64
|
+
# Context
|
|
65
|
+
|
|
66
|
+
context "When read access to a S3 bucket granted" do
|
|
67
|
+
|
|
68
|
+
describe "Can list S3 buckets" do
|
|
69
|
+
describe command('aws s3 ls') do
|
|
70
|
+
its( :exit_status ) { should eq 0 }
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
describe "Can list S3 bucket keys" do
|
|
75
|
+
default_ls = "aws s3 ls s3://#{bucket_name.value}"
|
|
76
|
+
region_ls = "aws s3 ls s3://#{bucket_name.value} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)"
|
|
77
|
+
describe command( "#{default_ls} || #{region_ls}" ) do
|
|
78
|
+
its ( :exit_status ) { should eq 0 }
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
context "When an Object exists in S3 bucket" do
|
|
84
|
+
|
|
85
|
+
before(:context) do
|
|
86
|
+
cmd = "echo tst | aws s3 cp - s3://#{bucket_name.value}/#{test_file}"
|
|
87
|
+
`#{cmd}`
|
|
88
|
+
raise "Error in '#{cmd}' " unless $? == 0
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
after(:context) do
|
|
92
|
+
cmd = "aws s3 rm s3://#{bucket_name.value}/#{test_file}"
|
|
93
|
+
`#{cmd}`
|
|
94
|
+
raise "Error in '#{cmd}' " unless $? == 0
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Using "serverspec" style here
|
|
98
|
+
describe "Can read the Object from a S3 bucket" do
|
|
99
|
+
default_cp = "aws s3 cp s3://#{bucket_name.value}/#{test_file} /tmp/#{test_file}"
|
|
100
|
+
region_cp = "aws s3 cp s3://#{bucket_name.value}/#{test_file} /tmp/#{test_file} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)"
|
|
101
|
+
describe command( "#{default_cp} || #{region_cp}" ) do
|
|
102
|
+
its( :exit_status ) { should eq 0 }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# using subject + expect style
|
|
108
|
+
describe "Cannot modify (= delete) the Object in bucket" do
|
|
109
|
+
|
|
110
|
+
describe command("aws s3 rm s3://#{bucket_name.value}/#{test_file} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)") do
|
|
111
|
+
its ( :exit_status ) { should_not eql 0 }
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
end # context test_file in bucket
|
|
117
|
+
|
|
118
|
+
# subject + it is_expected one liner
|
|
119
|
+
describe "Cannot write to bucket" do
|
|
120
|
+
|
|
121
|
+
describe "Create an Object in bucket should fail" do
|
|
122
|
+
describe command("aws s3 cp /etc/hosts s3://#{bucket_name.value}/#{test_file} --region $(aws s3api get-bucket-location --bucket #{bucket_name.value} --output text)") do
|
|
123
|
+
its( :exit_status ) { should_not eql 0 }
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# ------------------------------------------------------------------
|
|
130
|
+
#
|
|
131
|
+
|
|
132
|
+
context "When bucket does not exists" do
|
|
133
|
+
|
|
134
|
+
describe "Cannot list S3 bucket keys" do
|
|
135
|
+
|
|
136
|
+
describe command( "aws s3 ls s3://DASKLjwKLJ4534Buckert --region $(aws s3api get-bucket-location --bucket #{@bucket_name} --output text)") do
|
|
137
|
+
its( :exit_status ) { should_not eq 0 }
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
end
|