awspec 1.4.3 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a25dc9ad7bb00c00fe9f75c60fb65a3bb7d2b657
4
- data.tar.gz: 1250c5a36bc0f938e7cd66d7c24edaa9c514942f
3
+ metadata.gz: 2aaeb6e4dc658f764f20bec8fdac89d45a084797
4
+ data.tar.gz: e02bd3450a6008edef4b22b79a66cd798a8a0f1d
5
5
  SHA512:
6
- metadata.gz: f13db27a3fadd0865336cb3b3a8c1e53bb8edc1128c57a503b3042a5b44ac30e832ba9c9589fe58e93d1c55a2728a866089ccd4b888438475f7e3a37c2619efd
7
- data.tar.gz: 012cc4516ecafde2171abdef407ec9172be2f350c82ef477af2223eaaabbcbc1f60669e25473bf78a1dec9642e85686523d77c38c9c9e033c83a6a5db299cd71
6
+ metadata.gz: a9778ec751b40035b38ed973b86aad9efeedb766da6e002bf1bcafbd7b5afb43e4094ce361c79acf25c0a231c00d7de440f7463adb26a277362ca5d51ae8901d
7
+ data.tar.gz: c4b2e854c8bf2f6e954496030332bbb8a19c8ba671c5702f42054b1cea85041692d56ce757410f7f975fb8f3defdd8a8e829c994f0a36e770a96677e92439472
@@ -19,6 +19,10 @@ end
19
19
  ```ruby
20
20
  describe rds('my-rds') do
21
21
  it { should have_db_parameter_group('my-db-parameter-group') }
22
+ it do
23
+ should have_db_parameter_group('custom.mysql5.6')\
24
+ .parameter_apply_status('in-sync')
25
+ end
22
26
  end
23
27
  ```
24
28
 
@@ -27,6 +31,10 @@ end
27
31
  ```ruby
28
32
  describe rds('my-rds') do
29
33
  it { should have_option_group('default:mysql-5-6') }
34
+ it do
35
+ should have_option_group('default:mysql-5-6')\
36
+ .status('in-sync')
37
+ end
30
38
  end
31
39
  ```
32
40
 
@@ -2083,6 +2083,10 @@ end
2083
2083
  ```ruby
2084
2084
  describe rds('my-rds') do
2085
2085
  it { should have_db_parameter_group('my-db-parameter-group') }
2086
+ it do
2087
+ should have_db_parameter_group('custom.mysql5.6')\
2088
+ .parameter_apply_status('in-sync')
2089
+ end
2086
2090
  end
2087
2091
  ```
2088
2092
 
@@ -2092,6 +2096,10 @@ end
2092
2096
  ```ruby
2093
2097
  describe rds('my-rds') do
2094
2098
  it { should have_option_group('default:mysql-5-6') }
2099
+ it do
2100
+ should have_option_group('default:mysql-5-6')\
2101
+ .status('in-sync')
2102
+ end
2095
2103
  end
2096
2104
  ```
2097
2105
 
@@ -6,6 +6,8 @@ require 'awspec/matcher/have_network_interface'
6
6
 
7
7
  # RDS
8
8
  require 'awspec/matcher/belong_to_db_subnet_group'
9
+ require 'awspec/matcher/have_db_parameter_group'
10
+ require 'awspec/matcher/have_option_group'
9
11
 
10
12
  # SecurityGroup
11
13
  require 'awspec/matcher/be_opened'
@@ -0,0 +1,9 @@
1
+ RSpec::Matchers.define :have_db_parameter_group do |name|
2
+ match do |db_instance_identifier|
3
+ db_instance_identifier.has_db_parameter_group?(name, @parameter_apply_status)
4
+ end
5
+
6
+ chain :parameter_apply_status do |parameter_apply_status|
7
+ @parameter_apply_status = parameter_apply_status
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ RSpec::Matchers.define :have_option_group do |name|
2
+ match do |db_instance_identifier|
3
+ db_instance_identifier.has_option_group?(name, @status)
4
+ end
5
+
6
+ chain :status do |status|
7
+ @status = status
8
+ end
9
+ end
@@ -34,18 +34,22 @@ Aws.config[:rds] = {
34
34
  },
35
35
  db_parameter_groups: [
36
36
  {
37
- db_parameter_group_name: 'default.mysql5.6'
37
+ db_parameter_group_name: 'default.mysql5.6',
38
+ parameter_apply_status: 'pending-reboot'
38
39
  },
39
40
  {
40
- db_parameter_group_name: 'custom.mysql5.6'
41
+ db_parameter_group_name: 'custom.mysql5.6',
42
+ parameter_apply_status: 'in-sync'
41
43
  }
42
44
  ],
43
45
  option_group_memberships: [
44
46
  {
45
- option_group_name: 'default:mysql-5-6'
47
+ option_group_name: 'default:mysql-5-6',
48
+ status: 'in-sync'
46
49
  },
47
50
  {
48
- option_group_name: 'custom:mysql-5-6'
51
+ option_group_name: 'custom:mysql-5-6',
52
+ status: 'in-sync'
49
53
  }
50
54
  ],
51
55
  availability_zone: 'ap-northeast-1a',
@@ -37,17 +37,26 @@ module Awspec::Type
37
37
  return true if has_db_security_group_name?(sg_id)
38
38
  end
39
39
 
40
- def has_db_parameter_group?(name)
40
+ def has_db_parameter_group?(name, parameter_apply_status = nil)
41
41
  pgs = resource_via_client.db_parameter_groups
42
42
  pgs.find do |pg|
43
- pg.db_parameter_group_name == name
43
+ if parameter_apply_status.nil?
44
+ pg.db_parameter_group_name == name
45
+ else
46
+ pg.db_parameter_group_name == name && \
47
+ pg.parameter_apply_status == parameter_apply_status
48
+ end
44
49
  end
45
50
  end
46
51
 
47
- def has_option_group?(name)
52
+ def has_option_group?(name, status = nil)
48
53
  ogs = resource_via_client.option_group_memberships
49
54
  ogs.find do |og|
50
- og.option_group_name == name
55
+ if status.nil?
56
+ og.option_group_name == name
57
+ else
58
+ og.option_group_name == name && og.status == status
59
+ end
51
60
  end
52
61
  end
53
62
 
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.4.3'
2
+ VERSION = '1.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-24 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -445,10 +445,12 @@ files:
445
445
  - lib/awspec/matcher/belong_to_vpc.rb
446
446
  - lib/awspec/matcher/have_attribute_definition.rb
447
447
  - lib/awspec/matcher/have_custom_response_error_code.rb
448
+ - lib/awspec/matcher/have_db_parameter_group.rb
448
449
  - lib/awspec/matcher/have_inline_policy.rb
449
450
  - lib/awspec/matcher/have_key_policy.rb
450
451
  - lib/awspec/matcher/have_key_schema.rb
451
452
  - lib/awspec/matcher/have_network_interface.rb
453
+ - lib/awspec/matcher/have_option_group.rb
452
454
  - lib/awspec/matcher/have_origin.rb
453
455
  - lib/awspec/matcher/have_private_ip_address.rb
454
456
  - lib/awspec/matcher/have_record_set.rb