diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml index b450d70e..998b3096 100644 --- a/.kitchen.dokken.yml +++ b/.kitchen.dokken.yml @@ -107,3 +107,17 @@ suites: provider: binary options: version: 0.7.1 + - name: webui + provisioner: + policyfile: test/fixtures/policies/default.rb + attributes: + consul: + provider: binary + options: + version: 0.7.1 + config: + bootstrap: true + server: true + ui: true + datacenter: FortMeade + encrypt: CGXC2NsXW4AvuB4h5ODYzQ== diff --git a/libraries/consul_installation_webui.rb b/libraries/consul_installation_webui.rb index 13419b65..d057d822 100644 --- a/libraries/consul_installation_webui.rb +++ b/libraries/consul_installation_webui.rb @@ -51,10 +51,11 @@ def action_create recursive true end - zipfile options[:archive_basename] do - path ::File.join(options[:extract_to], new_resource.version) - source archive_url - checksum options[:archive_checksum] + poise_archive archive_url do + destination ::File.join(options[:extract_to], new_resource.version) + source_properties( + checksum: options[:archive_checksum] + ) not_if { ::File.exist?(::File.join(path, 'index.html')) } notifies :create, "link[#{options[:symlink_to]}]", :immediately end @@ -97,6 +98,7 @@ def self.binary_checksum(_node, resource) when '0.6.3' then '93bbb300cacfe8de90fb3bd5ede7d37ae6ce014898edc520b9c96a676b2bbb72' when '0.6.4' then '5f8841b51e0e3e2eb1f1dc66a47310ae42b0448e77df14c83bb49e0e0d5fa4b7' when '0.7.0' then '42212089c228a73a0881a5835079c8df58a4f31b5060a3b4ffd4c2497abe3aa8' + when '0.7.1' then '1b793c60e1af24cc470421d0411e13748f451b51d8a6ed5fcabc8d00bfb84264' end end end diff --git a/test/fixtures/cookbooks/consul_spec/recipes/default.rb b/test/fixtures/cookbooks/consul_spec/recipes/default.rb index 02ff2271..747a6775 100644 --- a/test/fixtures/cookbooks/consul_spec/recipes/default.rb +++ b/test/fixtures/cookbooks/consul_spec/recipes/default.rb @@ -2,3 +2,4 @@ include_recipe 'consul::default' include_recipe 'consul_spec::consul_definition' include_recipe 'consul_spec::consul_watch' +include_recipe 'consul_spec::consul_installation_webui' diff --git a/test/integration/webui/serverspec/webui_spec.rb b/test/integration/webui/serverspec/webui_spec.rb new file mode 100644 index 00000000..fe832958 --- /dev/null +++ b/test/integration/webui/serverspec/webui_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +consul_version = '0.7.1' + +unless windows? + describe file("/opt/consul-webui/#{consul_version}/base.css") do + it { should be_file } + end + + describe command('curl -X GET http://127.0.0.1:8500/ui/') do + its(:stdout) { should match /Consul by HashiCorp/ } + end +end diff --git a/test/spec/libraries/consul_installation_webui_spec.rb b/test/spec/libraries/consul_installation_webui_spec.rb index 973f4799..1cc21168 100644 --- a/test/spec/libraries/consul_installation_webui_spec.rb +++ b/test/spec/libraries/consul_installation_webui_spec.rb @@ -15,7 +15,6 @@ end it do - pending('replace with poise-archive') is_expected.to create_directory('/opt/consul-webui/0.7.1') .with( recursive: true @@ -23,7 +22,6 @@ end it do - pending('replace with poise-archive') is_expected.to create_directory('/var/lib/consul') .with( recursive: true @@ -31,10 +29,9 @@ end it do - pending('replace with poise-archive') - is_expected.to unzip_zipfile('consul_0.7.1_web_ui.zip') - .with( - source: 'https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip' + is_expected.to unpack_poise_archive('https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip').with( + destination: '/opt/consul-webui/0.7.1', + merged_source_properties: {'checksum' => '1b793c60e1af24cc470421d0411e13748f451b51d8a6ed5fcabc8d00bfb84264' } ) end end