|
163 | 163 | end |
164 | 164 | end |
165 | 165 | end |
| 166 | + |
| 167 | + describe '#disable_zero_copy' do |
| 168 | + it 'accepts disable_zero_copy as true' do |
| 169 | + expect { |
| 170 | + Asherah.configure do |config| |
| 171 | + base_config.call(config) |
| 172 | + config.disable_zero_copy = true |
| 173 | + end |
| 174 | + }.not_to raise_error |
| 175 | + Asherah.shutdown |
| 176 | + end |
| 177 | + |
| 178 | + it 'accepts disable_zero_copy as false' do |
| 179 | + expect { |
| 180 | + Asherah.configure do |config| |
| 181 | + base_config.call(config) |
| 182 | + config.disable_zero_copy = false |
| 183 | + end |
| 184 | + }.not_to raise_error |
| 185 | + Asherah.shutdown |
| 186 | + end |
| 187 | + end |
| 188 | + |
| 189 | + describe '#to_json' do |
| 190 | + it 'correctly maps all configuration options to Go JSON format' do |
| 191 | + config = Asherah::Config.new |
| 192 | + config.service_name = 'test-service' |
| 193 | + config.product_id = 'test-product' |
| 194 | + config.kms = 'aws' |
| 195 | + config.metastore = 'dynamodb' |
| 196 | + config.connection_string = 'mysql://localhost:3306/test' |
| 197 | + config.replica_read_consistency = 'eventual' |
| 198 | + config.sql_metastore_db_type = 'postgres' |
| 199 | + config.dynamo_db_endpoint = 'http://localhost:8000' |
| 200 | + config.dynamo_db_region = 'us-west-2' |
| 201 | + config.dynamo_db_table_name = 'test-table' |
| 202 | + config.enable_region_suffix = true |
| 203 | + config.region_map = { 'us-west-2' => 'arn' } |
| 204 | + config.preferred_region = 'us-west-2' |
| 205 | + config.session_cache_max_size = 500 |
| 206 | + config.session_cache_duration = 3600 |
| 207 | + config.enable_session_caching = true |
| 208 | + config.disable_zero_copy = true |
| 209 | + config.expire_after = 7200 |
| 210 | + config.check_interval = 1800 |
| 211 | + config.verbose = true |
| 212 | + |
| 213 | + json_output = JSON.parse(config.to_json) |
| 214 | + |
| 215 | + expect(json_output).to eq( |
| 216 | + 'ServiceName' => 'test-service', |
| 217 | + 'ProductID' => 'test-product', |
| 218 | + 'KMS' => 'aws', |
| 219 | + 'Metastore' => 'dynamodb', |
| 220 | + 'ConnectionString' => 'mysql://localhost:3306/test', |
| 221 | + 'ReplicaReadConsistency' => 'eventual', |
| 222 | + 'SQLMetastoreDBType' => 'postgres', |
| 223 | + 'DynamoDBEndpoint' => 'http://localhost:8000', |
| 224 | + 'DynamoDBRegion' => 'us-west-2', |
| 225 | + 'DynamoDBTableName' => 'test-table', |
| 226 | + 'EnableRegionSuffix' => true, |
| 227 | + 'RegionMap' => { 'us-west-2' => 'arn' }, |
| 228 | + 'PreferredRegion' => 'us-west-2', |
| 229 | + 'SessionCacheMaxSize' => 500, |
| 230 | + 'SessionCacheDuration' => 3600, |
| 231 | + 'EnableSessionCaching' => true, |
| 232 | + 'DisableZeroCopy' => true, |
| 233 | + 'ExpireAfter' => 7200, |
| 234 | + 'CheckInterval' => 1800, |
| 235 | + 'Verbose' => true |
| 236 | + ) |
| 237 | + end |
| 238 | + |
| 239 | + it 'excludes nil values from JSON output' do |
| 240 | + config = Asherah::Config.new |
| 241 | + config.service_name = 'test-service' |
| 242 | + config.product_id = 'test-product' |
| 243 | + config.kms = 'test-debug-static' |
| 244 | + config.metastore = 'test-debug-memory' |
| 245 | + |
| 246 | + json_output = JSON.parse(config.to_json) |
| 247 | + |
| 248 | + expect(json_output).to eq( |
| 249 | + 'ServiceName' => 'test-service', |
| 250 | + 'ProductID' => 'test-product', |
| 251 | + 'KMS' => 'test-debug-static', |
| 252 | + 'Metastore' => 'test-debug-memory' |
| 253 | + ) |
| 254 | + end |
| 255 | + end |
166 | 256 | end |
0 commit comments