|
5 | 5 | it 'includes java recipe' do
|
6 | 6 | expect(chef_run).to include_recipe('java::default')
|
7 | 7 | end
|
8 |
| - it 'installs go-agent package' do |
9 |
| - expect(chef_run).to install_package('go-agent') |
10 |
| - end |
11 | 8 | it 'creates go agent configuration in /etc/default/go-agent' do
|
12 | 9 | expect(chef_run).to render_file('/etc/default/go-agent').with_content { |content|
|
13 | 10 | expect(content).to_not include('java-6')
|
|
31 | 28 | end
|
32 | 29 | it_behaves_like :agent_recipe
|
33 | 30 | it_behaves_like :apt_repository_recipe
|
| 31 | + it 'installs go-agent package' do |
| 32 | + expect(chef_run).to install_package('go-agent') |
| 33 | + end |
34 | 34 | end
|
35 | 35 | context 'When all attributes are default and platform is centos' do
|
36 | 36 | let(:chef_run) do
|
|
43 | 43 | end
|
44 | 44 | it_behaves_like :agent_recipe
|
45 | 45 | it_behaves_like :yum_repository_recipe
|
| 46 | + it 'installs go-agent package' do |
| 47 | + expect(chef_run).to install_package('go-agent') |
| 48 | + end |
46 | 49 | end
|
47 | 50 | #TODO: agent on windows
|
| 51 | + |
| 52 | + context 'When installing from package_file and platform is debian' do |
| 53 | + let(:chef_run) do |
| 54 | + run = ChefSpec::SoloRunner.new do |node| |
| 55 | + node.automatic['lsb']['id'] = 'Debian' |
| 56 | + node.automatic['platform_family'] = 'debian' |
| 57 | + node.automatic['platform'] = 'debian' |
| 58 | + node.automatic['os'] = 'linux' |
| 59 | + node.normal['gocd']['install_method'] = 'package_file' |
| 60 | + end |
| 61 | + run.converge(described_recipe) |
| 62 | + end |
| 63 | + it_behaves_like :agent_recipe |
| 64 | + it 'downloads go-agent .deb from remote URL' do |
| 65 | + expect(chef_run).to create_remote_file('go-agent-15.2.0-2248.deb').with( |
| 66 | + source: 'http://download.go.cd/gocd-deb/go-agent-15.2.0-2248.deb') |
| 67 | + end |
| 68 | + it 'installs go-agent package from file' do |
| 69 | + expect(chef_run).to install_dpkg_package('go-agent') |
| 70 | + end |
| 71 | + end |
| 72 | + context 'When installing from package file and platform is centos' do |
| 73 | + let(:chef_run) do |
| 74 | + run = ChefSpec::SoloRunner.new do |node| |
| 75 | + node.automatic['platform_family'] = 'rhel' |
| 76 | + node.automatic['platform'] = 'centos' |
| 77 | + node.automatic['os'] = 'linux' |
| 78 | + node.normal['gocd']['install_method'] = 'package_file' |
| 79 | + end |
| 80 | + run.converge(described_recipe) |
| 81 | + end |
| 82 | + it_behaves_like :agent_recipe |
| 83 | + it 'downloads go-agent .rpm from remote URL' do |
| 84 | + expect(chef_run).to create_remote_file('go-agent-15.2.0-2248.noarch.rpm').with( |
| 85 | + source: 'http://download.go.cd/gocd-rpm/go-agent-15.2.0-2248.noarch.rpm') |
| 86 | + end |
| 87 | + it 'installs go-agent package from file' do |
| 88 | + expect(chef_run).to install_rpm_package('go-agent') |
| 89 | + end |
| 90 | + end |
48 | 91 | end
|
0 commit comments