|
64 | 64 |
|
65 | 65 | it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) }
|
66 | 66 | end
|
67 |
| - context 'does not add proxy to search command if set to latest and proxy is unset' do |
68 |
| - let(:params) { { ensure: 'latest' } } |
69 |
| - |
70 |
| - it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } |
71 |
| - it { is_expected.to contain_exec('pip_install_rpyc').without_unless(%r{--proxy}) } |
72 |
| - end |
73 | 67 | context 'adds proxy to install command if proxy set' do
|
74 | 68 | let(:params) { { proxy: 'http://my.proxy:3128' } }
|
75 | 69 |
|
76 | 70 | it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") }
|
77 | 71 | end
|
78 |
| - context 'adds proxy to search command if set to latest' do |
79 |
| - let(:params) { { proxy: 'http://my.proxy:3128', ensure: 'latest' } } |
80 |
| - |
81 |
| - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } |
82 |
| - it { is_expected.to contain_exec('pip_install_rpyc').with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } |
83 |
| - end |
84 | 72 | end
|
85 | 73 |
|
86 | 74 | describe 'index as' do
|
|
94 | 82 |
|
95 | 83 | it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") }
|
96 | 84 | end
|
97 |
| - context 'adds index to search command if set to latest' do |
98 |
| - let(:params) { { index: 'http://www.example.com/simple/', ensure: 'latest' } } |
99 |
| - |
100 |
| - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } |
101 |
| - end |
102 | 85 | end
|
103 | 86 |
|
104 | 87 | describe 'path as' do
|
|
109 | 92 | it { is_expected.to contain_exec('pip_install_rpyc').with_path(['/opt/python3/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin']) }
|
110 | 93 | end
|
111 | 94 | end
|
| 95 | + |
| 96 | + describe 'install latest' do |
| 97 | + context 'does not use pip search in unless' do |
| 98 | + let(:params) { { ensure: 'latest' } } |
| 99 | + |
| 100 | + it { is_expected.not_to contain_exec('pip_install_rpyc').with_unless(%r{search}) } |
| 101 | + end |
| 102 | + context 'checks installed version of a package by converting underscores in its name to dashes' do |
| 103 | + let(:params) { { ensure: 'latest', pkgname: 'wordpress_json' } } |
| 104 | + |
| 105 | + # yes, the exec title does not change if we use different pgkname |
| 106 | + it { is_expected.to contain_exec('pip_install_rpyc').with_unless(%r{wordpress-json}) } |
| 107 | + end |
| 108 | + end |
112 | 109 | end
|
113 | 110 | end
|
114 | 111 |
|
|
0 commit comments