Skip to content

Commit 96bf675

Browse files
committed
gocd#50 go agent chefspec when installing from package file
1 parent b5f0770 commit 96bf675

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

spec/go_agent_spec.rb

+46-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
it 'includes java recipe' do
66
expect(chef_run).to include_recipe('java::default')
77
end
8-
it 'installs go-agent package' do
9-
expect(chef_run).to install_package('go-agent')
10-
end
118
it 'creates go agent configuration in /etc/default/go-agent' do
129
expect(chef_run).to render_file('/etc/default/go-agent').with_content { |content|
1310
expect(content).to_not include('java-6')
@@ -31,6 +28,9 @@
3128
end
3229
it_behaves_like :agent_recipe
3330
it_behaves_like :apt_repository_recipe
31+
it 'installs go-agent package' do
32+
expect(chef_run).to install_package('go-agent')
33+
end
3434
end
3535
context 'When all attributes are default and platform is centos' do
3636
let(:chef_run) do
@@ -43,6 +43,49 @@
4343
end
4444
it_behaves_like :agent_recipe
4545
it_behaves_like :yum_repository_recipe
46+
it 'installs go-agent package' do
47+
expect(chef_run).to install_package('go-agent')
48+
end
4649
end
4750
#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
4891
end

0 commit comments

Comments
 (0)