-
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from darron/install-packages
Add packages install method.
- Loading branch information
Showing
7 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ | |
depends 'golang', '~> 1.4' | ||
depends 'runit' | ||
depends 'yum-repoforge' | ||
depends 'packagecloud' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright 2014 John Bellone <jbellone@bloomberg.net> | ||
# Copyright 2014 Bloomberg Finance L.P. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# NOTE: This is only supported for Ubuntu 12.04LTS and 14.04LTS. | ||
|
||
if node['consul']['use_packagecloud_repo'] | ||
|
||
packagecloud_repo "darron/consul" do | ||
type "deb" | ||
end | ||
|
||
packagecloud_repo "darron/consul-webui" do | ||
type "deb" | ||
end | ||
|
||
end | ||
|
||
package 'consul' | ||
package 'consul-webui' | ||
|
||
include_recipe 'consul::_service' |
55 changes: 55 additions & 0 deletions
55
test/integration/packages/serverspec/localhost/consul_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require 'spec_helper' | ||
|
||
describe command('which consul') do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should match '/usr/local/bin/consul' } | ||
end | ||
|
||
describe service('consul') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe file('/etc/consul.d') do | ||
it { should be_directory } | ||
end | ||
|
||
describe file('/var/lib/consul') do | ||
it { should be_directory } | ||
end | ||
|
||
[8300, 8400, 8500, 8600].each do |p| | ||
describe port(p) do | ||
it { should be_listening } | ||
end | ||
end | ||
|
||
describe command 'consul members -detailed' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should match %r{\balive\b} } | ||
its(:stdout) { should match %r{\brole=consul\b} } | ||
its(:stdout) { should match %r{\bbootstrap=1\b} } | ||
end | ||
|
||
describe 'config file attributes' do | ||
context command 'consul members -detailed' do | ||
its(:stdout) { should match %r{\bdc=fortmeade\b} } | ||
end | ||
end | ||
|
||
eth0_ip = command("/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").stdout.strip | ||
describe command("grep #{eth0_ip} /etc/consul.d/default.json") do | ||
its(:exit_status) { should eq 0 } | ||
# bind_addr should only be in the config if node[:consul][:bind_addr] is set | ||
its(:stdout) { should match %r{"bind_addr":\s"#{eth0_ip}"}} | ||
its(:stdout) { should match %r{"advertise_addr":\s"#{eth0_ip}"}} | ||
end | ||
|
||
describe command('grep encrypt /etc/consul.d/default.json') do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should match %r{"encrypt":\s"([^\"]*)"} } | ||
end | ||
|
||
describe file('/var/lib/consul/ui/index.html') do | ||
it { should be_file } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'serverspec' | ||
|
||
RSpec.configure do |c| | ||
c.path = '/usr/local/bin:/sbin:/bin:/usr/bin' | ||
end |