|
5 | 5 | lambda do |config| |
6 | 6 | config.service_name = 'gem' |
7 | 7 | config.product_id = 'sable' |
8 | | - config.kms = 'static' |
9 | | - config.metastore = 'memory' |
| 8 | + config.kms = 'test-debug-static' |
| 9 | + config.metastore = 'test-debug-memory' |
10 | 10 | end |
11 | 11 | } |
12 | 12 |
|
|
37 | 37 | end |
38 | 38 |
|
39 | 39 | describe '#validate_kms' do |
| 40 | + it 'accepts valid sql_metastore_db_type value' do |
| 41 | + expect { |
| 42 | + Asherah.configure do |config| |
| 43 | + base_config.call(config) |
| 44 | + config.kms = 'test-debug-static' |
| 45 | + end |
| 46 | + }.not_to raise_error |
| 47 | + Asherah.shutdown |
| 48 | + end |
| 49 | + |
40 | 50 | it 'raises an error when kms not set' do |
41 | 51 | expect { |
42 | 52 | Asherah.configure do |config| |
|
60 | 70 | end |
61 | 71 | end |
62 | 72 |
|
63 | | - describe '#validate_metastore' do |
64 | | - it 'raises an error when metastore not set' do |
| 73 | + describe '#validate_kms_attributes' do |
| 74 | + it 'raises an error when region_map not set' do |
65 | 75 | expect { |
66 | 76 | Asherah.configure do |config| |
67 | 77 | base_config.call(config) |
68 | | - config.metastore = nil |
| 78 | + config.kms = 'aws' |
69 | 79 | end |
70 | 80 | }.to raise_error(Asherah::Error::ConfigError) do |e| |
71 | | - expect(e.message).to eq('config.metastore not set') |
| 81 | + expect(e.message).to eq('config.region_map not set') |
72 | 82 | end |
73 | 83 | end |
74 | 84 |
|
75 | | - it 'raises an error when metastore is invalid' do |
| 85 | + it 'raises an error when preferred_region is not a hash' do |
76 | 86 | expect { |
77 | 87 | Asherah.configure do |config| |
78 | 88 | base_config.call(config) |
79 | | - config.metastore = 'other' |
| 89 | + config.kms = 'aws' |
| 90 | + config.region_map = 'us-west-2=arn' |
80 | 91 | end |
81 | 92 | }.to raise_error(Asherah::Error::ConfigError) do |e| |
82 | | - expect(e.message).to eq('config.metastore must be one of these: rdbms, dynamodb, memory, test-debug-memory') |
| 93 | + expect(e.message).to eq('config.region_map must be a Hash') |
83 | 94 | end |
84 | 95 | end |
85 | | - end |
86 | 96 |
|
87 | | - describe '#validate_kms_attributes' do |
88 | | - it 'raises an error when region_map not set' do |
| 97 | + it 'raises an error when preferred_region not set' do |
89 | 98 | expect { |
90 | 99 | Asherah.configure do |config| |
91 | 100 | base_config.call(config) |
92 | 101 | config.kms = 'aws' |
| 102 | + config.region_map = { 'us-west-2' => 'arn' } |
93 | 103 | end |
94 | 104 | }.to raise_error(Asherah::Error::ConfigError) do |e| |
95 | | - expect(e.message).to eq('config.region_map not set') |
| 105 | + expect(e.message).to eq('config.preferred_region not set') |
96 | 106 | end |
97 | 107 | end |
| 108 | + end |
98 | 109 |
|
99 | | - it 'raises an error when preferred_region is not a hash' do |
| 110 | + describe '#validate_metastore' do |
| 111 | + it 'accepts valid metastore value' do |
100 | 112 | expect { |
101 | 113 | Asherah.configure do |config| |
102 | 114 | base_config.call(config) |
103 | | - config.kms = 'aws' |
104 | | - config.region_map = 'us-west-2=arn' |
| 115 | + config.metastore = 'test-debug-memory' |
| 116 | + end |
| 117 | + }.not_to raise_error |
| 118 | + Asherah.shutdown |
| 119 | + end |
| 120 | + |
| 121 | + it 'raises an error when metastore not set' do |
| 122 | + expect { |
| 123 | + Asherah.configure do |config| |
| 124 | + base_config.call(config) |
| 125 | + config.metastore = nil |
105 | 126 | end |
106 | 127 | }.to raise_error(Asherah::Error::ConfigError) do |e| |
107 | | - expect(e.message).to eq('config.region_map must be a Hash') |
| 128 | + expect(e.message).to eq('config.metastore not set') |
108 | 129 | end |
109 | 130 | end |
110 | 131 |
|
111 | | - it 'raises an error when preferred_region not set' do |
| 132 | + it 'raises an error when metastore is invalid' do |
112 | 133 | expect { |
113 | 134 | Asherah.configure do |config| |
114 | 135 | base_config.call(config) |
115 | | - config.kms = 'aws' |
116 | | - config.region_map = { 'us-west-2' => 'arn' } |
| 136 | + config.metastore = 'other' |
117 | 137 | end |
118 | 138 | }.to raise_error(Asherah::Error::ConfigError) do |e| |
119 | | - expect(e.message).to eq('config.preferred_region not set') |
| 139 | + expect(e.message).to eq('config.metastore must be one of these: rdbms, dynamodb, memory, test-debug-memory') |
| 140 | + end |
| 141 | + end |
| 142 | + end |
| 143 | + |
| 144 | + describe '#validate_sql_metastore_db_type' do |
| 145 | + it 'accepts valid sql_metastore_db_type value' do |
| 146 | + expect { |
| 147 | + Asherah.configure do |config| |
| 148 | + base_config.call(config) |
| 149 | + config.sql_metastore_db_type = 'postgres' |
| 150 | + end |
| 151 | + }.not_to raise_error |
| 152 | + Asherah.shutdown |
| 153 | + end |
| 154 | + |
| 155 | + it 'raises an error when sql_metastore_db_type is invalid' do |
| 156 | + expect { |
| 157 | + Asherah.configure do |config| |
| 158 | + base_config.call(config) |
| 159 | + config.sql_metastore_db_type = 'other' |
| 160 | + end |
| 161 | + }.to raise_error(Asherah::Error::ConfigError) do |e| |
| 162 | + expect(e.message).to eq('config.sql_metastore_db_type must be one of these: mysql, postgres, oracle') |
120 | 163 | end |
121 | 164 | end |
122 | 165 | end |
|
0 commit comments