chef-provisioning-aws 3.0.4 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -5
  3. data/Rakefile +15 -6
  4. data/chef-provisioning-aws.gemspec +17 -17
  5. data/lib/chef/provider/aws_auto_scaling_group.rb +5 -6
  6. data/lib/chef/provider/aws_cache_cluster.rb +21 -15
  7. data/lib/chef/provider/aws_cache_replication_group.rb +12 -8
  8. data/lib/chef/provider/aws_cache_subnet_group.rb +3 -3
  9. data/lib/chef/provider/aws_cloudsearch_domain.rb +9 -13
  10. data/lib/chef/provider/aws_cloudwatch_alarm.rb +10 -12
  11. data/lib/chef/provider/aws_dhcp_options.rb +18 -21
  12. data/lib/chef/provider/aws_ebs_volume.rb +24 -26
  13. data/lib/chef/provider/aws_eip_address.rb +10 -13
  14. data/lib/chef/provider/aws_elasticsearch_domain.rb +19 -18
  15. data/lib/chef/provider/aws_iam_instance_profile.rb +5 -7
  16. data/lib/chef/provider/aws_iam_role.rb +14 -17
  17. data/lib/chef/provider/aws_image.rb +6 -6
  18. data/lib/chef/provider/aws_instance.rb +5 -5
  19. data/lib/chef/provider/aws_internet_gateway.rb +8 -11
  20. data/lib/chef/provider/aws_key_pair.rb +15 -17
  21. data/lib/chef/provider/aws_launch_configuration.rb +11 -14
  22. data/lib/chef/provider/aws_load_balancer.rb +1 -2
  23. data/lib/chef/provider/aws_nat_gateway.rb +6 -7
  24. data/lib/chef/provider/aws_network_acl.rb +28 -29
  25. data/lib/chef/provider/aws_network_interface.rb +25 -27
  26. data/lib/chef/provider/aws_rds_instance.rb +12 -13
  27. data/lib/chef/provider/aws_rds_parameter_group.rb +8 -8
  28. data/lib/chef/provider/aws_rds_subnet_group.rb +8 -9
  29. data/lib/chef/provider/aws_route_table.rb +19 -20
  30. data/lib/chef/provider/aws_s3_bucket.rb +22 -25
  31. data/lib/chef/provider/aws_security_group.rb +268 -285
  32. data/lib/chef/provider/aws_server_certificate.rb +6 -5
  33. data/lib/chef/provider/aws_sns_topic.rb +4 -6
  34. data/lib/chef/provider/aws_sqs_queue.rb +3 -4
  35. data/lib/chef/provider/aws_subnet.rb +29 -34
  36. data/lib/chef/provider/aws_vpc.rb +108 -116
  37. data/lib/chef/provider/aws_vpc_peering_connection.rb +11 -11
  38. data/lib/chef/provisioning/aws_driver.rb +4 -2
  39. data/lib/chef/provisioning/aws_driver/aws_provider.rb +234 -241
  40. data/lib/chef/provisioning/aws_driver/aws_rds_resource.rb +5 -7
  41. data/lib/chef/provisioning/aws_driver/aws_resource.rb +182 -185
  42. data/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb +17 -17
  43. data/lib/chef/provisioning/aws_driver/aws_taggable.rb +13 -15
  44. data/lib/chef/provisioning/aws_driver/aws_tagger.rb +47 -48
  45. data/lib/chef/provisioning/aws_driver/credentials.rb +96 -100
  46. data/lib/chef/provisioning/aws_driver/credentials2.rb +42 -45
  47. data/lib/chef/provisioning/aws_driver/driver.rb +1349 -1362
  48. data/lib/chef/provisioning/aws_driver/exceptions.rb +10 -12
  49. data/lib/chef/provisioning/aws_driver/super_lwrp.rb +60 -60
  50. data/lib/chef/provisioning/aws_driver/tagging_strategy/auto_scaling.rb +49 -50
  51. data/lib/chef/provisioning/aws_driver/tagging_strategy/ec2.rb +37 -38
  52. data/lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb +14 -15
  53. data/lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb +29 -31
  54. data/lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb +39 -40
  55. data/lib/chef/provisioning/aws_driver/tagging_strategy/s3.rb +41 -43
  56. data/lib/chef/provisioning/aws_driver/version.rb +5 -5
  57. data/lib/chef/provisioning/driver_init/aws.rb +2 -2
  58. data/lib/chef/resource/aws_auto_scaling_group.rb +1 -1
  59. data/lib/chef/resource/aws_cache_cluster.rb +9 -12
  60. data/lib/chef/resource/aws_cache_replication_group.rb +9 -11
  61. data/lib/chef/resource/aws_cache_subnet_group.rb +8 -10
  62. data/lib/chef/resource/aws_cloudsearch_domain.rb +4 -5
  63. data/lib/chef/resource/aws_cloudwatch_alarm.rb +17 -18
  64. data/lib/chef/resource/aws_dhcp_options.rb +2 -2
  65. data/lib/chef/resource/aws_ebs_volume.rb +10 -10
  66. data/lib/chef/resource/aws_eip_address.rb +5 -5
  67. data/lib/chef/resource/aws_elasticsearch_domain.rb +4 -4
  68. data/lib/chef/resource/aws_iam_instance_profile.rb +4 -5
  69. data/lib/chef/resource/aws_iam_role.rb +2 -3
  70. data/lib/chef/resource/aws_image.rb +3 -3
  71. data/lib/chef/resource/aws_instance.rb +4 -4
  72. data/lib/chef/resource/aws_internet_gateway.rb +3 -3
  73. data/lib/chef/resource/aws_key_pair.rb +7 -7
  74. data/lib/chef/resource/aws_launch_configuration.rb +4 -4
  75. data/lib/chef/resource/aws_load_balancer.rb +7 -7
  76. data/lib/chef/resource/aws_nat_gateway.rb +11 -11
  77. data/lib/chef/resource/aws_network_acl.rb +7 -8
  78. data/lib/chef/resource/aws_network_interface.rb +9 -9
  79. data/lib/chef/resource/aws_rds_instance.rb +4 -4
  80. data/lib/chef/resource/aws_rds_parameter_group.rb +3 -3
  81. data/lib/chef/resource/aws_rds_subnet_group.rb +4 -4
  82. data/lib/chef/resource/aws_route53_hosted_zone.rb +37 -40
  83. data/lib/chef/resource/aws_route53_record_set.rb +22 -24
  84. data/lib/chef/resource/aws_route_table.rb +7 -7
  85. data/lib/chef/resource/aws_s3_bucket.rb +7 -7
  86. data/lib/chef/resource/aws_security_group.rb +10 -10
  87. data/lib/chef/resource/aws_server_certificate.rb +6 -8
  88. data/lib/chef/resource/aws_sns_topic.rb +2 -2
  89. data/lib/chef/resource/aws_sqs_queue.rb +5 -7
  90. data/lib/chef/resource/aws_subnet.rb +9 -9
  91. data/lib/chef/resource/aws_vpc.rb +11 -11
  92. data/lib/chef/resource/aws_vpc_peering_connection.rb +4 -4
  93. data/spec/aws_support.rb +44 -45
  94. data/spec/aws_support/aws_resource_run_wrapper.rb +2 -2
  95. data/spec/aws_support/deep_matcher.rb +2 -3
  96. data/spec/aws_support/deep_matcher/fuzzy_match_objects.rb +6 -9
  97. data/spec/aws_support/deep_matcher/match_values_failure_messages.rb +30 -37
  98. data/spec/aws_support/deep_matcher/matchable_array.rb +0 -1
  99. data/spec/aws_support/deep_matcher/matchable_object.rb +1 -2
  100. data/spec/aws_support/deep_matcher/rspec_monkeypatches.rb +4 -4
  101. data/spec/aws_support/delayed_stream.rb +2 -2
  102. data/spec/aws_support/matchers/create_an_aws_object.rb +6 -6
  103. data/spec/aws_support/matchers/destroy_an_aws_object.rb +6 -6
  104. data/spec/aws_support/matchers/have_aws_object_tags.rb +4 -5
  105. data/spec/aws_support/matchers/match_an_aws_object.rb +5 -6
  106. data/spec/aws_support/matchers/update_an_aws_object.rb +6 -7
  107. data/spec/integration/aws_auto_scaling_group_spec.rb +56 -64
  108. data/spec/integration/aws_cache_cluster_spec.rb +70 -71
  109. data/spec/integration/aws_cache_subnet_group_spec.rb +13 -14
  110. data/spec/integration/aws_cloudsearch_domain_spec.rb +6 -8
  111. data/spec/integration/aws_cloudwatch_alarm_spec.rb +200 -208
  112. data/spec/integration/aws_dhcp_options_spec.rb +32 -43
  113. data/spec/integration/aws_ebs_volume_spec.rb +52 -73
  114. data/spec/integration/aws_eip_address_spec.rb +24 -31
  115. data/spec/integration/aws_elasticsearch_domain_spec.rb +31 -33
  116. data/spec/integration/aws_iam_instance_profile_spec.rb +36 -45
  117. data/spec/integration/aws_iam_role_spec.rb +39 -46
  118. data/spec/integration/aws_internet_gateway_spec.rb +64 -75
  119. data/spec/integration/aws_key_pair_spec.rb +6 -6
  120. data/spec/integration/aws_launch_configuration_spec.rb +17 -18
  121. data/spec/integration/aws_nat_gateway_spec.rb +21 -24
  122. data/spec/integration/aws_network_acl_spec.rb +81 -95
  123. data/spec/integration/aws_network_interface_spec.rb +28 -43
  124. data/spec/integration/aws_rds_instance_spec.rb +29 -40
  125. data/spec/integration/aws_rds_parameter_group_spec.rb +32 -35
  126. data/spec/integration/aws_rds_subnet_group_spec.rb +30 -40
  127. data/spec/integration/aws_route53_hosted_zone_spec.rb +205 -205
  128. data/spec/integration/aws_route_table_spec.rb +118 -136
  129. data/spec/integration/aws_s3_bucket_spec.rb +19 -27
  130. data/spec/integration/aws_security_group_spec.rb +369 -388
  131. data/spec/integration/aws_server_certificate_spec.rb +16 -18
  132. data/spec/integration/aws_subnet_spec.rb +44 -58
  133. data/spec/integration/aws_vpc_peering_connection_spec.rb +43 -50
  134. data/spec/integration/aws_vpc_spec.rb +99 -115
  135. data/spec/integration/load_balancer_spec.rb +169 -183
  136. data/spec/integration/machine_batch_spec.rb +24 -31
  137. data/spec/integration/machine_image_spec.rb +54 -66
  138. data/spec/integration/machine_spec.rb +216 -237
  139. data/spec/persistence_file.txt +219 -0
  140. data/spec/spec_helper.rb +16 -17
  141. data/spec/unit/chef/provisioning/aws_driver/credentials_spec.rb +67 -74
  142. data/spec/unit/chef/provisioning/aws_driver/driver_spec.rb +29 -29
  143. data/spec/unit/chef/provisioning/aws_driver/route53_spec.rb +13 -15
  144. metadata +4 -3
@@ -1,73 +1,62 @@
1
1
  describe "AwsDhcpOptions" do
2
2
  extend AWSSupport
3
3
 
4
- when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
4
+ when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
5
5
  with_aws "when connected to AWS" do
6
-
7
6
  it "creates an aws_dhcp_options resource with maximum attributes" do
8
- expect_recipe {
9
- aws_dhcp_options 'test-dhcp-options' do
10
- domain_name 'example.com'
11
- domain_name_servers %w(8.8.8.8 8.8.4.4)
12
- ntp_servers %w(8.8.8.8 8.8.4.4)
13
- netbios_name_servers %w(8.8.8.8 8.8.4.4)
7
+ expect_recipe do
8
+ aws_dhcp_options "test-dhcp-options" do
9
+ domain_name "example.com"
10
+ domain_name_servers %w{8.8.8.8 8.8.4.4}
11
+ ntp_servers %w{8.8.8.8 8.8.4.4}
12
+ netbios_name_servers %w{8.8.8.8 8.8.4.4}
14
13
  netbios_node_type 2
15
14
  end
16
- }.to create_an_aws_dhcp_options('test-dhcp-options', dhcp_configurations: [
17
- {key: "domain-name", values: [{value: "example.com"}]},
18
- {key: "domain-name-servers", values: [{value: "8.8.8.8"}, {value: "8.8.4.4"}]},
19
- {key: "ntp-servers", values: [{value: "8.8.8.8"}, {value: "8.8.4.4"}]},
20
- {key: "netbios-node-type", values: [{value: "2"}]},
21
- {key: "netbios-name-servers", values: [{value: "8.8.8.8"}, {value: "8.8.4.4"}]}
22
- ]).and be_idempotent
15
+ end.to create_an_aws_dhcp_options("test-dhcp-options", dhcp_configurations: [
16
+ { key: "domain-name", values: [{ value: "example.com" }] },
17
+ { key: "domain-name-servers", values: [{ value: "8.8.8.8" }, { value: "8.8.4.4" }] },
18
+ { key: "ntp-servers", values: [{ value: "8.8.8.8" }, { value: "8.8.4.4" }] },
19
+ { key: "netbios-node-type", values: [{ value: "2" }] },
20
+ { key: "netbios-name-servers", values: [{ value: "8.8.8.8" }, { value: "8.8.4.4" }] }
21
+ ]).and be_idempotent
23
22
  end
24
23
 
25
24
  it "creates aws_dhcp_options tags" do
26
- expect_recipe {
27
- aws_dhcp_options 'test-dhcp-options' do
25
+ expect_recipe do
26
+ aws_dhcp_options "test-dhcp-options" do
28
27
  aws_tags key1: "value"
29
28
  end
30
- }.to create_an_aws_dhcp_options('test-dhcp-options')
31
- .and have_aws_dhcp_options_tags('test-dhcp-options',
32
- {
33
- 'Name' => 'test-dhcp-options',
34
- 'key1' => 'value'
35
- }
36
- ).and be_idempotent
29
+ end.to create_an_aws_dhcp_options("test-dhcp-options")
30
+ .and have_aws_dhcp_options_tags("test-dhcp-options",
31
+ "Name" => "test-dhcp-options",
32
+ "key1" => "value").and be_idempotent
37
33
  end
38
34
 
39
35
  context "with existing tags" do
40
- aws_dhcp_options 'test-dhcp-options' do
36
+ aws_dhcp_options "test-dhcp-options" do
41
37
  aws_tags key1: "value"
42
38
  end
43
39
 
44
40
  it "updates aws_dhcp_options tags" do
45
- expect_recipe {
46
- aws_dhcp_options 'test-dhcp-options' do
41
+ expect_recipe do
42
+ aws_dhcp_options "test-dhcp-options" do
47
43
  aws_tags key1: "value2", key2: nil
48
44
  end
49
- }.to have_aws_dhcp_options_tags('test-dhcp-options',
50
- {
51
- 'Name' => 'test-dhcp-options',
52
- 'key1' => 'value2',
53
- 'key2' => ''
54
- }
55
- ).and be_idempotent
45
+ end.to have_aws_dhcp_options_tags("test-dhcp-options",
46
+ "Name" => "test-dhcp-options",
47
+ "key1" => "value2",
48
+ "key2" => "").and be_idempotent
56
49
  end
57
50
 
58
51
  it "removes all aws_dhcp_options tags except Name" do
59
- expect_recipe {
60
- aws_dhcp_options 'test-dhcp-options' do
61
- aws_tags Hash.new
52
+ expect_recipe do
53
+ aws_dhcp_options "test-dhcp-options" do
54
+ aws_tags({})
62
55
  end
63
- }.to have_aws_dhcp_options_tags('test-dhcp-options',
64
- {
65
- 'Name' => 'test-dhcp-options'
66
- }
67
- ).and be_idempotent
56
+ end.to have_aws_dhcp_options_tags("test-dhcp-options",
57
+ "Name" => "test-dhcp-options").and be_idempotent
68
58
  end
69
59
  end
70
-
71
60
  end
72
61
  end
73
62
  end
@@ -1,146 +1,125 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Chef::Resource::AwsEbsVolume do
4
4
  extend AWSSupport
5
5
 
6
- when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
6
+ when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
7
7
  with_aws "when connected to AWS" do
8
-
9
8
  it "aws_ebs_volume 'test_volume' creates an ebs volume" do
10
- expect_recipe {
9
+ expect_recipe do
11
10
  aws_ebs_volume "test_volume"
12
- }.to create_an_aws_ebs_volume('test_volume',
13
- size: 8
14
- ).and be_idempotent
11
+ end.to create_an_aws_ebs_volume("test_volume",
12
+ size: 8).and be_idempotent
15
13
  end
16
14
 
17
- describe 'action :delete' do
18
- with_converge {
15
+ describe "action :delete" do
16
+ with_converge do
19
17
  aws_ebs_volume "test_volume" do
20
- availability_zone 'a'
18
+ availability_zone "a"
21
19
  size 8
22
20
  end
23
- }
21
+ end
24
22
  it "deletes the ebs volume" do
25
- # TODO all the `with_*` and `expect_*` methods from Cheffish
23
+ # TODO: all the `with_*` and `expect_*` methods from Cheffish
26
24
  # automatically converge the block - we don't want to do that,
27
25
  # we want to let the `destroy_an*` matcher do that
28
- r = recipe {
26
+ r = recipe do
29
27
  aws_ebs_volume "test_volume" do
30
28
  action :destroy
31
29
  end
32
- }
33
- expect(r).to destroy_an_aws_ebs_volume('test_volume'
34
- ).and be_idempotent
30
+ end
31
+ expect(r).to destroy_an_aws_ebs_volume("test_volume").and be_idempotent
35
32
  end
36
33
  end
37
34
 
38
35
  it "aws_ebs_volume 'test_volume_az' creates an ebs volume when provided proper full AZ" do
39
- expect_recipe {
36
+ expect_recipe do
40
37
  aws_ebs_volume "test_volume_az" do
41
38
  availability_zone "#{driver.region}a"
42
39
  end
43
- }.to create_an_aws_ebs_volume('test_volume_az')
44
- .and be_idempotent
40
+ end.to create_an_aws_ebs_volume("test_volume_az")
41
+ .and be_idempotent
45
42
  end
46
43
 
47
44
  # These tests are testing the tagging functionality - they use some example resources rather
48
45
  # because these are integration tests so we cannot make a mock resource.
49
46
  it "aws_ebs_volume 'test_volume' created with default Name tag" do
50
- expect_recipe {
47
+ expect_recipe do
51
48
  aws_ebs_volume "test_volume"
52
- }.to create_an_aws_ebs_volume('test_volume'
53
- ).and have_aws_ebs_volume_tags('test_volume',
54
- { 'Name' => 'test_volume' }
55
- ).and be_idempotent
49
+ end.to create_an_aws_ebs_volume("test_volume").and have_aws_ebs_volume_tags("test_volume",
50
+ "Name" => "test_volume").and be_idempotent
56
51
  end
57
52
 
58
53
  it "allows users to specify a unique Name tag" do
59
- expect_recipe {
54
+ expect_recipe do
60
55
  aws_ebs_volume "test_volume_2" do
61
- aws_tags :Name => 'test_volume_new'
56
+ aws_tags Name: "test_volume_new"
62
57
  end
63
- }.to create_an_aws_ebs_volume('test_volume_2'
64
- ).and have_aws_ebs_volume_tags('test_volume_2',
65
- { 'Name' => 'test_volume_new' }
66
- ).and be_idempotent
58
+ end.to create_an_aws_ebs_volume("test_volume_2").and have_aws_ebs_volume_tags("test_volume_2",
59
+ "Name" => "test_volume_new").and be_idempotent
67
60
  end
68
61
 
69
62
  it "allows tags to be specified as strings or symbols" do
70
- expect_recipe {
63
+ expect_recipe do
71
64
  aws_ebs_volume "test_volume" do
72
- aws_tags({
65
+ aws_tags(
73
66
  :key1 => :symbol,
74
- 'key2' => :symbol,
75
- :key3 => 'string',
76
- 'key4' => 'string'
77
- })
67
+ "key2" => :symbol,
68
+ :key3 => "string",
69
+ "key4" => "string"
70
+ )
78
71
  end
79
- }.to create_an_aws_ebs_volume('test_volume'
80
- ).and have_aws_ebs_volume_tags('test_volume',
81
- {
82
- 'key1' => 'symbol',
83
- 'key2' => 'symbol',
84
- 'key3' => 'string',
85
- 'key4' => 'string'
86
- }
87
- ).and be_idempotent
72
+ end.to create_an_aws_ebs_volume("test_volume").and have_aws_ebs_volume_tags("test_volume",
73
+ "key1" => "symbol",
74
+ "key2" => "symbol",
75
+ "key3" => "string",
76
+ "key4" => "string").and be_idempotent
88
77
  end
89
78
 
90
79
  context "when there are existing tags" do
91
80
  before(:each) do
92
- converge {
81
+ converge do
93
82
  aws_ebs_volume "test_volume_a" do
94
- aws_tags :byebye => 'true'
83
+ aws_tags byebye: "true"
95
84
  end
96
- }
85
+ end
97
86
  end
98
87
 
99
88
  after(:each) do
100
- converge {
89
+ converge do
101
90
  aws_ebs_volume "test_volume_a" do
102
91
  action :purge
103
92
  end
104
- }
93
+ end
105
94
  end
106
95
 
107
96
  it "updates the tags" do
108
- expect_recipe {
97
+ expect_recipe do
109
98
  aws_ebs_volume "test_volume_a" do
110
- aws_tags 'Name' => 'test_volume_b', :project => 'X'
99
+ aws_tags "Name" => "test_volume_b", :project => "X"
111
100
  end
112
- }.to have_aws_ebs_volume_tags('test_volume_a',
113
- {
114
- 'Name' => 'test_volume_b',
115
- 'project' => 'X'
116
- }
117
- ).and be_idempotent
101
+ end.to have_aws_ebs_volume_tags("test_volume_a",
102
+ "Name" => "test_volume_b",
103
+ "project" => "X").and be_idempotent
118
104
  end
119
105
 
120
106
  it "deletes the tags" do
121
- expect_recipe {
107
+ expect_recipe do
122
108
  aws_ebs_volume "test_volume_a" do
123
109
  aws_tags({})
124
110
  end
125
- }.to have_aws_ebs_volume_tags('test_volume_a',
126
- {
127
- 'Name' => 'test_volume_a',
128
- }
129
- ).and be_idempotent
111
+ end.to have_aws_ebs_volume_tags("test_volume_a",
112
+ "Name" => "test_volume_a").and be_idempotent
130
113
  end
131
114
 
132
115
  it "aws_ebs_volume 'test_volume' tags are not changed when not updated" do
133
- expect_recipe {
134
- #aws_ebs_volume "test_volume_a"
135
- }.to have_aws_ebs_volume_tags('test_volume_a',
136
- {
137
- 'Name' => 'test_volume_a',
138
- 'byebye' => 'true'
139
- }
140
- )
116
+ expect_recipe do
117
+ # aws_ebs_volume "test_volume_a"
118
+ end.to have_aws_ebs_volume_tags("test_volume_a",
119
+ "Name" => "test_volume_a",
120
+ "byebye" => "true")
141
121
  end
142
122
  end
143
-
144
123
  end
145
124
  end
146
125
  end
@@ -1,61 +1,56 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Chef::Resource::AwsEipAddress do
4
4
  extend AWSSupport
5
5
 
6
- when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
6
+ when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
7
7
  with_aws "when connected to AWS" do
8
-
9
8
  it "aws_eip_address 'test_eip' creates an elastic ip" do
10
- expect_recipe {
9
+ expect_recipe do
11
10
  aws_eip_address "test_eip"
12
- }.to create_an_aws_eip_address('test_eip',
13
- ).and be_idempotent
11
+ end.to create_an_aws_eip_address("test_eip").and be_idempotent
14
12
  end
15
13
 
16
14
  it "raises an error trying to reference an eip that does not exist" do
17
- r = recipe {
15
+ r = recipe do
18
16
  aws_eip_address "0.0.0.0"
19
- }
20
- expect {r.converge}.to raise_error(/Chef::Resource::AwsEipAddress\[0.0.0.0\] does not exist!/)
17
+ end
18
+ expect { r.converge }.to raise_error(/Chef::Resource::AwsEipAddress\[0.0.0.0\] does not exist!/)
21
19
  end
22
20
 
23
21
  context "with an existing aws_eip_address" do
24
22
  aws_eip_address "test_eip"
25
23
 
26
24
  it "can reference the ip address by id in the name field" do
27
- expect_recipe {
25
+ expect_recipe do
28
26
  aws_eip_address test_eip.aws_object.public_ip
29
- }.to match_an_aws_eip_address(test_eip.aws_object.public_ip,
30
- public_ip: test_eip.aws_object.public_ip
31
- ).and be_idempotent
27
+ end.to match_an_aws_eip_address(test_eip.aws_object.public_ip,
28
+ public_ip: test_eip.aws_object.public_ip).and be_idempotent
32
29
  end
33
30
 
34
31
  it "can reference the ip address in the public_ip field" do
35
- expect_recipe {
32
+ expect_recipe do
36
33
  aws_eip_address "random_identifier" do
37
34
  public_ip test_eip.aws_object.public_ip
38
35
  end
39
- }.to match_an_aws_eip_address("random_identifier",
40
- public_ip: test_eip.aws_object.public_ip
41
- ).and be_idempotent
36
+ end.to match_an_aws_eip_address("random_identifier",
37
+ public_ip: test_eip.aws_object.public_ip).and be_idempotent
42
38
  end
43
39
  end
44
40
 
45
- describe 'action :delete' do
41
+ describe "action :delete" do
46
42
  aws_eip_address "test_eip"
47
43
 
48
44
  it "deletes the elastic ip" do
49
- # TODO all the `with_*` and `expect_*` methods from Cheffish
45
+ # TODO: all the `with_*` and `expect_*` methods from Cheffish
50
46
  # automatically converge the block - we don't want to do that,
51
47
  # we want to let the `destroy_an*` matcher do that
52
- r = recipe {
48
+ r = recipe do
53
49
  aws_eip_address "test_eip" do
54
50
  action :destroy
55
51
  end
56
- }
57
- expect(r).to destroy_an_aws_eip_address('test_eip'
58
- ).and be_idempotent
52
+ end
53
+ expect(r).to destroy_an_aws_eip_address("test_eip").and be_idempotent
59
54
  end
60
55
  end
61
56
 
@@ -63,25 +58,23 @@ describe Chef::Resource::AwsEipAddress do
63
58
  purge_all
64
59
  setup_public_vpc
65
60
 
66
- machine 'test_machine' do
61
+ machine "test_machine" do
67
62
  machine_options bootstrap_options: {
68
- subnet_id: 'test_public_subnet',
69
- key_name: 'test_key_pair'
63
+ subnet_id: "test_public_subnet",
64
+ key_name: "test_key_pair"
70
65
  }
71
66
  action :ready # The box has to be online for AWS to accept it as routable
72
67
  end
73
68
 
74
69
  it "associates an EIP with a machine" do
75
- expect_recipe {
70
+ expect_recipe do
76
71
  aws_eip_address "test_eip" do
77
72
  associate_to_vpc true
78
73
  machine "test_machine"
79
74
  end
80
- }.to create_an_aws_eip_address('test_eip',
81
- instance_id: test_machine.aws_object.id
82
- ).and be_idempotent
75
+ end.to create_an_aws_eip_address("test_eip",
76
+ instance_id: test_machine.aws_object.id).and be_idempotent
83
77
  end
84
-
85
78
  end
86
79
  end
87
80
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  def policy(user)
4
4
  <<EOF
@@ -41,44 +41,43 @@ describe Chef::Resource::AwsElasticsearchDomain do
41
41
  extend AWSSupport
42
42
 
43
43
  let(:all_options_result) do
44
- {created: true,
45
- elasticsearch_cluster_config: {
46
- instance_type: "m4.large.elasticsearch",
47
- instance_count: 2,
48
- dedicated_master_enabled: true,
49
- dedicated_master_type: "m4.large.elasticsearch",
50
- zone_awareness_enabled: true
51
- },
52
- ebs_options: {
53
- ebs_enabled: true,
54
- volume_size: 35,
55
- volume_type: "io1",
56
- iops: 1000
57
- },
58
- snapshot_options: {
59
- automated_snapshot_start_hour: 2
60
- }
61
- }
44
+ { created: true,
45
+ elasticsearch_cluster_config: {
46
+ instance_type: "m4.large.elasticsearch",
47
+ instance_count: 2,
48
+ dedicated_master_enabled: true,
49
+ dedicated_master_type: "m4.large.elasticsearch",
50
+ zone_awareness_enabled: true
51
+ },
52
+ ebs_options: {
53
+ ebs_enabled: true,
54
+ volume_size: 35,
55
+ volume_type: "io1",
56
+ iops: 1000
57
+ },
58
+ snapshot_options: {
59
+ automated_snapshot_start_hour: 2
60
+ } }
62
61
  end
63
62
 
64
63
  when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
65
64
  with_aws "when connected to AWS" do
66
- time = DateTime.now.strftime('%Q')
65
+ time = DateTime.now.strftime("%Q")
67
66
 
68
67
  it "returns nil when aws_object is called for something that does not exist" do
69
68
  r = nil
70
- converge {
69
+ converge do
71
70
  r = aws_elasticsearch_domain "wont-exist" do
72
71
  action :nothing
73
72
  end
74
- }
73
+ end
75
74
  expect(r.aws_object).to eq(nil)
76
75
  end
77
76
 
78
77
  it "aws_elasticsearch_domain 'test-#{time}' creates a elasticsearch domain" do
79
- expect_recipe {
78
+ expect_recipe do
80
79
  all_options_domain("test-#{time}")
81
- }.to create_an_aws_elasticsearch_domain("test-#{time}", all_options_result).and be_idempotent
80
+ end.to create_an_aws_elasticsearch_domain("test-#{time}", all_options_result).and be_idempotent
82
81
  end
83
82
 
84
83
  context "with an existing elasticsearch domain" do
@@ -88,32 +87,31 @@ describe Chef::Resource::AwsElasticsearchDomain do
88
87
  end
89
88
 
90
89
  it "can update all options" do
91
- expect_recipe {
90
+ expect_recipe do
92
91
  all_options_domain("test-#{time}-2")
93
- }.to update_an_aws_elasticsearch_domain("test-#{time}-2", all_options_result)
92
+ end.to update_an_aws_elasticsearch_domain("test-#{time}-2", all_options_result)
94
93
  end
95
94
 
96
95
  it "updates the aws_tags" do
97
- expect_recipe {
96
+ expect_recipe do
98
97
  all_options_domain("test-#{time}-2")
99
- }.to have_aws_elasticsearch_domain_tags("test-#{time}-2", {'key1' => 'value'})
98
+ end.to have_aws_elasticsearch_domain_tags("test-#{time}-2", "key1" => "value")
100
99
  end
101
100
 
102
101
  it "removes all aws_elasticsearch_domain tags" do
103
- expect_recipe {
102
+ expect_recipe do
104
103
  aws_elasticsearch_domain "test-#{time}-2" do
105
104
  aws_tags({})
106
105
  end
107
- }.to have_aws_elasticsearch_domain_tags("test-#{time}-2", {}).and be_idempotent
106
+ end.to have_aws_elasticsearch_domain_tags("test-#{time}-2", {}).and be_idempotent
108
107
  end
109
108
 
110
-
111
109
  it "destroys an elasticsearch domain" do
112
- r = recipe {
110
+ r = recipe do
113
111
  aws_elasticsearch_domain "test-#{time}-2" do
114
112
  action :destroy
115
113
  end
116
- }
114
+ end
117
115
  expect(r).to destroy_an_aws_elasticsearch_domain("test-#{time}-2")
118
116
  end
119
117
  end