Skip to content

Commit

Permalink
Spec fix (puppetlabs#105)
Browse files Browse the repository at this point in the history
* adding in pass_hash param for test environment

* fixing rakefile
  • Loading branch information
davejrt authored and scotty-c committed Jan 7, 2018
1 parent 6b9ef9e commit 3a70bdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ task :test => [
:syntax,
:lint,
:metadata_lint,
:spec,
]
20 changes: 10 additions & 10 deletions spec/defines/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@
:kernelrelease => '3.2.0-4-amd64',
:operatingsystemmajrelease => '8',
} }
let(:params) { { 'version' => '17.06' } }
let(:params) { { 'version' => '17.06', 'pass_hash' => 'test1234' } }
it { should contain_exec('localhost:5000 auth') }

context 'with ensure => present' do
let(:params) { { 'ensure' => 'absent', 'version' => '17.06' } }
let(:params) { { 'ensure' => 'absent', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'username' => 'user1', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'password' => 'secret', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'email' => 'user1@example.io', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'username' => 'user1', 'password' => 'secret', 'email' => 'user1@example.io', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'ensure' => 'present', 'username' => 'user1', 'password' => 'secret', 'email' => 'user1@example.io', 'version' => '1.9.0', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'username' => 'user1', 'password' => 'secret', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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' } }
let(:params) { { 'username' => 'user1', 'password' => 'secret', 'local_user' => 'testuser', 'version' => '17.06', 'pass_hash' => 'test1234' } }
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

Expand Down

0 comments on commit 3a70bdd

Please sign in to comment.