1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
|
require 'spec_helper'
describe 'keystone' do
shared_examples 'keystone' do
context 'with default parameters' do
it { is_expected.to contain_class('keystone::logging') }
it { is_expected.to contain_class('keystone::params') }
it { is_expected.to contain_class('keystone::policy') }
it { is_expected.to contain_package('keystone').with(
:ensure => 'present',
:name => platform_params[:package_name],
:tag => ['openstack', 'keystone-package'],
) }
it { is_expected.to contain_class('openstacklib::openstackclient') }
it 'should synchronize the db if $sync_db is true' do
is_expected.to contain_exec('keystone-manage db_sync').with(
:command => 'keystone-manage db_sync',
:user => 'keystone',
:refreshonly => true,
:subscribe => ['Anchor[keystone::install::end]',
'Anchor[keystone::config::end]',
'Anchor[keystone::dbsync::begin]'],
:notify => 'Anchor[keystone::dbsync::end]',
)
end
it 'should set the default values' do
is_expected.to contain_resources('keystone_config').with({ :purge => false })
is_expected.to contain_keystone_config('DEFAULT/public_endpoint').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('token/provider').with_value('fernet')
is_expected.to contain_keystone_config('token/expiration').with_value(3600)
is_expected.to contain_keystone_config('identity/password_hash_algorithm').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('identity/password_hash_rounds').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('identity/max_password_length').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('revoke/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('policy/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('token/revoke_by_id').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('keystone_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
)
is_expected.to contain_keystone_config('catalog/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('catalog/template_file').with_value('/etc/keystone/default_catalog.templates')
is_expected.to contain_keystone_config('DEFAULT/max_token_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/list_limit').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/notification_format').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('DEFAULT/notification_opt_out').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__messaging__default('keystone_config').with(
:executor_thread_pool_size => '<SERVICE DEFAULT>',
:transport_url => '<SERVICE DEFAULT>',
:control_exchange => '<SERVICE DEFAULT>',
:rpc_response_timeout => '<SERVICE DEFAULT>',
)
is_expected.to contain_oslo__messaging__notifications('keystone_config').with(
:transport_url => '<SERVICE DEFAULT>',
:driver => '<SERVICE DEFAULT>',
:topics => '<SERVICE DEFAULT>',
:retry => '<SERVICE DEFAULT>',
)
is_expected.to contain_oslo__messaging__rabbit('keystone_config').with(
:kombu_ssl_version => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
:kombu_failover_strategy => '<SERVICE DEFAULT>',
:kombu_compression => '<SERVICE DEFAULT>',
:rabbit_use_ssl => '<SERVICE DEFAULT>',
:rabbit_ha_queues => '<SERVICE DEFAULT>',
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
:heartbeat_rate => '<SERVICE DEFAULT>',
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
:rabbit_qos_prefetch_count => '<SERVICE DEFAULT>',
:amqp_durable_queues => '<SERVICE DEFAULT>',
:amqp_auto_delete => '<SERVICE DEFAULT>',
:rabbit_quorum_queue => '<SERVICE DEFAULT>',
:rabbit_transient_quorum_queue => '<SERVICE DEFAULT>',
:rabbit_transient_queues_ttl => '<SERVICE DEFAULT>',
:rabbit_quorum_delivery_limit => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_length => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_bytes => '<SERVICE DEFAULT>',
:enable_cancel_on_failover => '<SERVICE DEFAULT>',
)
is_expected.to contain_keystone_config('identity/domain_specific_drivers_enabled').with_ensure('absent')
is_expected.to contain_keystone_config('identity/domain_config_dir').with_ensure('absent')
end
it { is_expected.to contain_service('keystone').with(
'ensure' => 'running',
'enable' => true,
'hasstatus' => true,
'hasrestart' => true,
'tag' => 'keystone-service',
) }
it { is_expected.to contain_anchor('keystone::service::end') }
it { is_expected.to contain_exec('keystone-manage db_sync') }
it { is_expected.to_not contain_file('/etc/keystone/domains') }
it { is_expected.to contain_file('/etc/keystone/fernet-keys').with(
:ensure => 'directory',
:owner => 'keystone',
:group => 'keystone',
'mode' => '0600',
) }
it { is_expected.to contain_exec('keystone-manage fernet_setup').with(
:command => 'keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone',
:user => 'keystone',
:creates => '/etc/keystone/fernet-keys/0',
:require => 'File[/etc/keystone/fernet-keys]',
) }
it { is_expected.to contain_keystone_config('fernet_tokens/key_repository').with_value('/etc/keystone/fernet-keys') }
it { is_expected.to contain_file('/etc/keystone/credential-keys').with(
:ensure => 'directory',
:owner => 'keystone',
:group => 'keystone',
'mode' => '0600',
) }
it { is_expected.to contain_exec('keystone-manage credential_setup').with(
:command => 'keystone-manage credential_setup --keystone-user keystone --keystone-group keystone',
:user => 'keystone',
:creates => '/etc/keystone/credential-keys/0',
:require => 'File[/etc/keystone/credential-keys]',
) }
it { is_expected.to contain_keystone_config('credential/key_repository').with_value('/etc/keystone/credential-keys')}
end
context 'with overridden parameters' do
let :params do
{
:purge_config => true,
:public_endpoint => 'http://127.0.0.1:5000',
:token_provider => 'uuid',
:token_expiration => 7200,
:password_hash_algorithm => 'bcrypt',
:password_hash_rounds => 12,
:max_password_length => 54,
:revoke_driver => 'sql',
:policy_driver => 'sql',
:revoke_by_id => true,
:enable_proxy_headers_parsing => true,
:max_request_body_size => 114688,
:catalog_driver => 'templated',
:catalog_template_file => '/some/template_file',
:max_token_size => 255,
:list_limit => 10000,
:notification_format => 'basic',
:notification_opt_out => [
'identity.authenticate.success',
'identity.authenticate.pending',
'identity.authenticate.failed'
],
}
end
it 'should set the overridden values' do
is_expected.to contain_resources('keystone_config').with({ :purge => true })
is_expected.to contain_keystone_config('DEFAULT/public_endpoint').with_value('http://127.0.0.1:5000')
is_expected.to contain_keystone_config('token/provider').with_value('uuid')
is_expected.to contain_keystone_config('token/expiration').with_value(7200)
is_expected.to contain_keystone_config('identity/password_hash_algorithm').with_value('bcrypt')
is_expected.to contain_keystone_config('identity/password_hash_rounds').with_value(12)
is_expected.to contain_keystone_config('identity/max_password_length').with_value(54)
is_expected.to contain_keystone_config('revoke/driver').with_value('sql')
is_expected.to contain_keystone_config('policy/driver').with_value('sql')
is_expected.to contain_keystone_config('token/revoke_by_id').with_value(true)
is_expected.to contain_oslo__middleware('keystone_config').with(
:enable_proxy_headers_parsing => true,
:max_request_body_size => 114688,
)
is_expected.to contain_keystone_config('catalog/driver').with_value('templated')
is_expected.to contain_keystone_config('catalog/template_file').with_value('/some/template_file')
is_expected.to contain_keystone_config('DEFAULT/max_token_size').with_value(255)
is_expected.to contain_keystone_config('DEFAULT/list_limit').with_value(10000)
is_expected.to contain_keystone_config('DEFAULT/notification_format').with_value('basic')
is_expected.to contain_keystone_config('DEFAULT/notification_opt_out').with_value([
'identity.authenticate.success',
'identity.authenticate.pending',
'identity.authenticate.failed'
])
end
end
context "when running keystone in wsgi" do
let :params do
{ 'service_name' => 'httpd' }
end
let :pre_condition do
'include apache
include keystone::wsgi::apache'
end
it do
if facts[:os]['name'] == 'Debian'
is_expected.to contain_service('keystone').with(
:ensure => 'stopped',
:name => platform_params[:service_name],
:enable => false,
:tag => 'keystone-service',
)
else
is_expected.to_not contain_service('keystone')
end
end
it { is_expected.to contain_exec('restart_keystone').with(
'command' => "systemctl restart #{platform_params[:httpd_service_name]}",
) }
end
context 'when using invalid service name for keystone' do
let (:params) do
{ 'service_name' => 'foo' }
end
it_raises 'a Puppet::Error', /Invalid service_name/
end
context 'with disabled service managing' do
let :params do
{ :manage_service => false }
end
it { is_expected.to_not contain_service('keystone') }
end
context 'with disabled package managing' do
let :params do
{ :manage_package => false }
end
it { is_expected.to_not contain_package('keystone') }
it { is_expected.to_not contain_class('openstacklib::openstackclient') }
end
context 'when sync_db is set to false' do
let :params do
{
'sync_db' => false,
}
end
it { is_expected.not_to contain_exec('keystone-manage db_sync') }
end
context 'with RabbitMQ communication SSLed' do
let :params do
{
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
}
end
it { is_expected.to contain_oslo__messaging__rabbit('keystone_config').with(
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
)}
end
context 'with RabbitMQ communication not SSLed' do
let :params do
{}
end
it { is_expected.to contain_oslo__messaging__rabbit('keystone_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_version => '<SERVICE DEFAULT>'
)}
end
context 'setting notification settings' do
let :params do
{
:default_transport_url => 'rabbit://user:pass@host:1234/virt',
:notification_transport_url => 'rabbit://user:pass@host:1234/virt',
:notification_driver => ['keystone.openstack.common.notifier.rpc_notifier'],
:notification_topics => ['notifications'],
:notification_retry => 10,
:control_exchange => 'keystone',
:rpc_response_timeout => 120,
:executor_thread_pool_size => 64,
}
end
it {
is_expected.to contain_oslo__messaging__default('keystone_config').with(
:executor_thread_pool_size => 64,
:transport_url => 'rabbit://user:pass@host:1234/virt',
:control_exchange => 'keystone',
:rpc_response_timeout => 120,
)
is_expected.to contain_oslo__messaging__notifications('keystone_config').with(
:transport_url => 'rabbit://user:pass@host:1234/virt',
:driver => ['keystone.openstack.common.notifier.rpc_notifier'],
:topics => ['notifications'],
:retry => 10,
)
}
end
context 'setting kombu settings' do
let :params do
{
:kombu_reconnect_delay => '1.0',
:kombu_compression => 'gzip',
}
end
it {
is_expected.to contain_oslo__messaging__rabbit('keystone_config').with(
:kombu_reconnect_delay => '1.0',
:kombu_compression => 'gzip',
) }
end
context 'when disabling credential_setup' do
let :params do
{
'enable_credential_setup' => false,
}
end
it { is_expected.to_not contain_file('/etc/keystone/credential-keys') }
it { is_expected.to_not contain_exec('keystone-manage credential_setup') }
it { is_expected.to contain_keystone_config('credential/key_repository').with_value('/etc/keystone/credential-keys') }
end
context 'when overriding the credential key directory' do
let :params do
{
'enable_credential_setup' => true,
'credential_key_repository' => '/var/lib/credential-keys',
}
end
it { is_expected.to contain_file('/var/lib/credential-keys').with(
:ensure => 'directory',
:owner => 'keystone',
:group => 'keystone',
'mode' => '0600',
) }
it { is_expected.to contain_exec('keystone-manage credential_setup').with(
:creates => '/var/lib/credential-keys/0'
) }
it { is_expected.to contain_keystone_config('credential/key_repository').with_value('/var/lib/credential-keys') }
end
context 'when overriding the keystone group and user' do
let :params do
{
'enable_credential_setup' => true,
'keystone_user' => 'test_user',
'keystone_group' => 'test_group',
}
end
it { is_expected.to contain_exec('keystone-manage credential_setup').with(
:command => "keystone-manage credential_setup --keystone-user #{params['keystone_user']} --keystone-group #{params['keystone_group']}",
:user => params['keystone_user'],
:creates => '/etc/keystone/credential-keys/0',
:require => 'File[/etc/keystone/credential-keys]',
) }
end
context 'when setting credential_keys parameter' do
let :params do
{
'enable_credential_setup' => true,
'credential_keys' => {
'/etc/keystone/credential-keys/0' => {
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
},
'/etc/keystone/credential-keys/1' => {
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
},
}
}
end
it { is_expected.to_not contain_exec('keystone-manage credential_setup') }
it { is_expected.to contain_file('/etc/keystone/credential-keys/0').with(
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
'owner' => 'keystone',
:show_diff => false,
'subscribe' => 'Anchor[keystone::install::end]',
)}
it { is_expected.to contain_file('/etc/keystone/credential-keys/1').with(
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
'owner' => 'keystone',
:show_diff => false,
'subscribe' => 'Anchor[keystone::install::end]',
)}
end
context 'when disabling fernet_setup' do
let :params do
{
'enable_fernet_setup' => false,
}
end
it { is_expected.to_not contain_file('/etc/keystone/fernet-keys') }
it { is_expected.to_not contain_exec('keystone-manage fernet_setup') }
it { is_expected.to contain_keystone_config('fernet_tokens/key_repository').with_value('/etc/keystone/fernet-keys') }
end
context 'when enabling fernet_setup' do
let :params do
{
'enable_fernet_setup' => true,
'fernet_max_active_keys' => 5,
}
end
it { is_expected.to contain_file('/etc/keystone/fernet-keys').with(
:ensure => 'directory',
:owner => 'keystone',
:group => 'keystone',
:mode => '0600',
) }
it { is_expected.to contain_exec('keystone-manage fernet_setup').with(
:command => 'keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone',
:user => 'keystone',
:creates => '/etc/keystone/fernet-keys/0',
:require => 'File[/etc/keystone/fernet-keys]',
) }
it { is_expected.to contain_keystone_config('fernet_tokens/max_active_keys').with_value(5)}
end
context 'when overriding the fernet key directory' do
let :params do
{
'enable_fernet_setup' => true,
'fernet_key_repository' => '/var/lib/fernet-keys',
}
end
it { is_expected.to contain_file('/var/lib/fernet-keys').with(
:ensure => 'directory',
:owner => 'keystone',
:group => 'keystone',
:mode => '0600',
) }
it { is_expected.to contain_exec('keystone-manage fernet_setup').with(
:creates => '/var/lib/fernet-keys/0'
) }
it { is_expected.to contain_keystone_config('fernet_tokens/key_repository').with_value('/var/lib/fernet-keys') }
end
context 'when overriding the keystone group and user' do
let :params do
{
'enable_fernet_setup' => true,
'keystone_user' => 'test_user',
'keystone_group' => 'test_group',
}
end
it { is_expected.to contain_exec('keystone-manage fernet_setup').with(
:command => "keystone-manage fernet_setup --keystone-user #{params['keystone_user']} --keystone-group #{params['keystone_group']}",
:user => params['keystone_user'],
:creates => '/etc/keystone/fernet-keys/0',
:require => 'File[/etc/keystone/fernet-keys]',
) }
end
context 'when setting fernet_keys parameter' do
let :params do
{
'enable_fernet_setup' => true,
'fernet_keys' => {
'/etc/keystone/fernet-keys/0' => {
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
},
'/etc/keystone/fernet-keys/1' => {
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
},
}
}
end
it { is_expected.to_not contain_exec('keystone-manage fernet_setup') }
it { is_expected.to contain_file('/etc/keystone/fernet-keys/0').with(
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
'owner' => 'keystone',
'mode' => '0600',
'replace' => true,
'subscribe' => 'Anchor[keystone::install::end]',
'tag' => 'keystone-fernet-key',
)}
it { is_expected.to contain_file('/etc/keystone/fernet-keys/1').with(
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
'owner' => 'keystone',
'mode' => '0600',
'replace' => true,
'subscribe' => 'Anchor[keystone::install::end]',
'tag' => 'keystone-fernet-key',
)}
end
context 'when not replacing fernet_keys and setting fernet_keys parameter' do
let :params do
{
'enable_fernet_setup' => true,
'fernet_keys' => {
'/etc/keystone/fernet-keys/0' => {
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
},
'/etc/keystone/fernet-keys/1' => {
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
},
},
'fernet_replace_keys' => false,
}
end
it { is_expected.to_not contain_exec('keystone-manage fernet_setup') }
it { is_expected.to contain_file('/etc/keystone/fernet-keys/0').with(
'content' => 't-WdduhORSqoyAykuqWAQSYjg2rSRuJYySgI2xh48CI=',
'owner' => 'keystone',
'mode' => '0600',
'replace' => false,
'subscribe' => 'Anchor[keystone::install::end]',
)}
it { is_expected.to contain_file('/etc/keystone/fernet-keys/1').with(
'content' => 'GLlnyygEVJP4-H2OMwClXn3sdSQUZsM5F194139Unv8=',
'owner' => 'keystone',
'mode' => '0600',
'replace' => false,
'subscribe' => 'Anchor[keystone::install::end]',
)}
end
context 'with default domain and eventlet service is managed and enabled' do
let :params do
{ 'default_domain' => 'test' }
end
it { is_expected.to contain_exec('restart_keystone').with(
'command' => "systemctl restart #{platform_params[:service_name]}",
) }
it { is_expected.to contain_anchor('default_domain_created') }
end
context 'with default domain and wsgi service is managed and enabled' do
let :pre_condition do
'include apache'
end
let :params do
{
'default_domain'=> 'test',
'service_name' => 'httpd',
}
end
it { is_expected.to contain_anchor('default_domain_created') }
end
context 'with default domain and service is not managed' do
let :params do
{
'default_domain' => 'test',
'manage_service' => false,
}
end
it { is_expected.to_not contain_exec('restart_keystone') }
it { is_expected.to contain_anchor('default_domain_created') }
end
context 'when using domain config' do
let :params do
{ 'using_domain_config'=> true }
end
it { is_expected.to contain_file('/etc/keystone/domains').with(
'ensure' => "directory",
) }
it { is_expected
.to contain_keystone_config('identity/domain_specific_drivers_enabled')
.with('value' => true,
) }
it { is_expected
.to contain_keystone_config('identity/domain_config_dir')
.with('value' => '/etc/keystone/domains',
) }
end
context 'when using domain config and a wrong directory' do
let :params do
{
'using_domain_config'=> true,
'domain_config_directory' => 'this/is/not/an/absolute/path'
}
end
it { should raise_error(Puppet::Error) }
end
context 'when setting domain directory and not using domain config' do
let :params do
{
'using_domain_config'=> false,
'domain_config_directory' => '/this/is/an/absolute/path'
}
end
it 'should raise an error' do
expect { should contain_file('/etc/keystone/domains') }
.to raise_error(Puppet::Error, %r(You must activate domain))
end
end
context 'when setting domain directory and using domain config' do
let :params do
{
'using_domain_config'=> true,
'domain_config_directory' => '/this/is/an/absolute/path'
}
end
it { is_expected.to contain_file('/this/is/an/absolute/path').with(
'ensure' => "directory",
) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:os]['family']
when 'Debian'
{ :package_name => 'keystone',
:service_name => 'keystone',
:httpd_service_name => 'apache2' }
when 'RedHat'
{ :package_name => 'openstack-keystone',
:service_name => 'openstack-keystone',
:httpd_service_name => 'httpd' }
end
end
it_behaves_like 'keystone'
end
end
end
|