|
200 | 200 | end
|
201 | 201 | end
|
202 | 202 |
|
| 203 | + context "when availability_zone and tenancy are provided" do |
| 204 | + let(:config) do |
| 205 | + { |
| 206 | + :region => "eu-east-1", |
| 207 | + :availability_zone => "c", |
| 208 | + :tenancy => "dedicated" |
| 209 | + } |
| 210 | + end |
| 211 | + it "adds the region to it in the instance data" do |
| 212 | + expect(generator.ec2_instance_data).to eq( |
| 213 | + :instance_type => nil, |
| 214 | + :ebs_optimized => nil, |
| 215 | + :image_id => nil, |
| 216 | + :key_name => nil, |
| 217 | + :subnet_id => nil, |
| 218 | + :private_ip_address => nil, |
| 219 | + :placement => { :availability_zone => "eu-east-1c", |
| 220 | + :tenancy => "dedicated" } |
| 221 | + ) |
| 222 | + end |
| 223 | + end |
| 224 | + |
| 225 | + context "when tenancy is provided but availability_zone isn't" do |
| 226 | + let(:config) do |
| 227 | + { |
| 228 | + :region => "eu-east-1", |
| 229 | + :tenancy => "default" |
| 230 | + } |
| 231 | + end |
| 232 | + it "is not added to the instance data" do |
| 233 | + expect(generator.ec2_instance_data).to eq( |
| 234 | + :instance_type => nil, |
| 235 | + :ebs_optimized => nil, |
| 236 | + :image_id => nil, |
| 237 | + :key_name => nil, |
| 238 | + :subnet_id => nil, |
| 239 | + :private_ip_address => nil, |
| 240 | + :placement => { :tenancy => "default" } |
| 241 | + ) |
| 242 | + end |
| 243 | + end |
| 244 | + |
| 245 | + context "when tenancy is not supported" do |
| 246 | + let(:config) do |
| 247 | + { |
| 248 | + :region => "eu-east-1", |
| 249 | + :tenancy => "ephemeral" |
| 250 | + } |
| 251 | + end |
| 252 | + it "is not added to the instance data" do |
| 253 | + expect(generator.ec2_instance_data).to eq( |
| 254 | + :instance_type => nil, |
| 255 | + :ebs_optimized => nil, |
| 256 | + :image_id => nil, |
| 257 | + :key_name => nil, |
| 258 | + :subnet_id => nil, |
| 259 | + :private_ip_address => nil |
| 260 | + ) |
| 261 | + end |
| 262 | + end |
| 263 | + |
| 264 | + context "when availability_zone and tenancy are provided" do |
| 265 | + let(:config) do |
| 266 | + { |
| 267 | + :region => "eu-east-1", |
| 268 | + :availability_zone => "c", |
| 269 | + :tenancy => "dedicated" |
| 270 | + } |
| 271 | + end |
| 272 | + it "adds the region to it in the instance data" do |
| 273 | + expect(generator.ec2_instance_data).to eq( |
| 274 | + :instance_type => nil, |
| 275 | + :ebs_optimized => nil, |
| 276 | + :image_id => nil, |
| 277 | + :key_name => nil, |
| 278 | + :subnet_id => nil, |
| 279 | + :private_ip_address => nil, |
| 280 | + :placement => { :availability_zone => "eu-east-1c", |
| 281 | + :tenancy => "dedicated" } |
| 282 | + ) |
| 283 | + end |
| 284 | + end |
| 285 | + |
| 286 | + context "when tenancy is provided but availability_zone isn't" do |
| 287 | + let(:config) do |
| 288 | + { |
| 289 | + :region => "eu-east-1", |
| 290 | + :tenancy => "default" |
| 291 | + } |
| 292 | + end |
| 293 | + it "is not added to the instance data" do |
| 294 | + expect(generator.ec2_instance_data).to eq( |
| 295 | + :instance_type => nil, |
| 296 | + :ebs_optimized => nil, |
| 297 | + :image_id => nil, |
| 298 | + :key_name => nil, |
| 299 | + :subnet_id => nil, |
| 300 | + :private_ip_address => nil, |
| 301 | + :placement => { :tenancy => "default" } |
| 302 | + ) |
| 303 | + end |
| 304 | + end |
| 305 | + |
| 306 | + context "when tenancy is not supported" do |
| 307 | + let(:config) do |
| 308 | + { |
| 309 | + :region => "eu-east-1", |
| 310 | + :tenancy => "ephemeral" |
| 311 | + } |
| 312 | + end |
| 313 | + it "is not added to the instance data" do |
| 314 | + expect(generator.ec2_instance_data).to eq( |
| 315 | + :instance_type => nil, |
| 316 | + :ebs_optimized => nil, |
| 317 | + :image_id => nil, |
| 318 | + :key_name => nil, |
| 319 | + :subnet_id => nil, |
| 320 | + :private_ip_address => nil |
| 321 | + ) |
| 322 | + end |
| 323 | + end |
| 324 | + |
203 | 325 | context "when subnet_id is provided" do
|
204 | 326 | let(:config) do
|
205 | 327 | {
|
|
0 commit comments