Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9124186
registry_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
registry_spec.rb
View Options
require
'spec_helper'
describe
'docker::registry'
,
:type
=>
:define
do
let
(
:title
)
{
'localhost:5000'
}
let
(
:facts
)
{
{
:osfamily
=>
'Debian'
,
:operatingsystem
=>
'Debian'
,
:lsbdistid
=>
'Debian'
,
:lsbdistcodename
=>
'jessie'
,
:kernelrelease
=>
'3.2.0-4-amd64'
,
:operatingsystemmajrelease
=>
'8'
,
}
}
let
(
:params
)
{
{
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
}
context
'with ensure => present'
do
let
(
:params
)
{
{
'ensure'
=>
'absent'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
'docker logout localhost:5000'
)
}
end
context
'with ensure => present'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
'docker login localhost:5000'
)
}
end
context
'with ensure => present and username => user1'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'username'
=>
'user1'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
'docker login localhost:5000'
)
}
end
context
'with ensure => present and password => secret'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'password'
=>
'secret'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
'docker login localhost:5000'
)
}
end
context
'with ensure => present and email => user1@example.io'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'email'
=>
'user1@example.io'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
'docker login localhost:5000'
)
}
end
context
'with ensure => present and username => user1, and password => secret and email => user1@example.io'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'username'
=>
'user1'
,
'password'
=>
'secret'
,
'email'
=>
'user1@example.io'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
"docker login -u 'user1' -p
\"
${password}
\"
localhost:5000"
)
.
with_environment
(
'password=secret'
)
}
end
context
'with ensure => present and username => user1, and password => secret and email => user1@example.io and version < 1.11.0'
do
let
(
:params
)
{
{
'ensure'
=>
'present'
,
'username'
=>
'user1'
,
'password'
=>
'secret'
,
'email'
=>
'user1@example.io'
,
'version'
=>
'1.9.0'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
"docker login -u 'user1' -p
\"
${password}
\"
-e 'user1@example.io' localhost:5000"
)
.
with_environment
(
'password=secret'
)
}
end
context
'with username => user1, and password => secret'
do
let
(
:params
)
{
{
'username'
=>
'user1'
,
'password'
=>
'secret'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
"docker login -u 'user1' -p
\"
${password}
\"
localhost:5000"
)
.
with_environment
(
'password=secret'
)
}
end
context
'with username => user1, and password => secret and local_user => testuser'
do
let
(
:params
)
{
{
'username'
=>
'user1'
,
'password'
=>
'secret'
,
'local_user'
=>
'testuser'
,
'version'
=>
'17.06'
}
}
it
{
should
contain_exec
(
'localhost:5000 auth'
)
.
with_command
(
"docker login -u 'user1' -p
\"
${password}
\"
localhost:5000"
)
.
with_user
(
'testuser'
)
.
with_environment
(
'password=secret'
)
}
end
context
'with an invalid ensure value'
do
let
(
:params
)
{
{
'ensure'
=>
'not present or absent'
}
}
it
do
expect
{
should
contain_exec
(
'docker logout localhost:5000'
)
}
.
to
raise_error
(
Puppet
::
Error
)
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sat, Jun 21, 6:47 PM (2 w, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3428853
Attached To
R205 puppet-puppetlabs-docker
Event Timeline
Log In to Comment