Add support for [docker_registry] parameters

Change-Id: I95e3a312cd429d7c95c2c734408f03774e552186
This commit is contained in:
Takashi Kajinami 2021-12-17 13:09:01 +09:00
parent b3f2138647
commit c8b6273600
3 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# == Class: magnum::docker_registry
#
# Setup magnum docker_registry.
#
# === Parameters
#
# [*swift_region*]
# (optional) Region name of Swift.
# Defaults to $::os_service_default
#
# [*swift_registry_container*]
# (optional) Name of the container in Swift which docker registry stores
# images in.
# Defaults to $::os_service_default
#
class magnum::docker_registry (
$swift_region = $::os_service_default,
$swift_registry_container = $::os_service_default,
) {
magnum_config {
'docker_registry/swift_region': value => $swift_region;
'docker_registry/swift_registry_container': value => $swift_registry_container;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``magnum::docker_registry`` class has been added.

View File

@ -0,0 +1,38 @@
require 'spec_helper'
describe 'magnum::docker_registry' do
shared_examples 'magnum::docker_registry' do
it 'contains default values' do
is_expected.to contain_magnum_config('docker_registry/swift_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('docker_registry/swift_registry_container').with_value('<SERVICE DEFAULT>')
end
context 'configure docker_registry with parameters' do
let :params do
{
:swift_region => 'regionOne',
:swift_registry_container => 'docker_registry',
}
end
it 'contains overrided values' do
is_expected.to contain_magnum_config('docker_registry/swift_region').with_value('regionOne')
is_expected.to contain_magnum_config('docker_registry/swift_registry_container').with_value('docker_registry')
end
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
it_behaves_like 'magnum::docker_registry'
end
end
end