Skip to content

Commit 5867706

Browse files
committed
fix unit test error that set attribute after converge
1 parent 10b5cf4 commit 5867706

File tree

4 files changed

+331
-230
lines changed

4 files changed

+331
-230
lines changed

recipes/source.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
build_essential 'install compilation tools'
2121
include_recipe 'golang::default'
2222

23+
# rubocop:disable Style/PercentLiteralDelimiters
2324
# These packages are needed go build
2425
%w(curl git-core mercurial gzip sed).each do |pkg|
2526
package pkg
2627
end
28+
# rubocop:enable Style/PercentLiteralDelimiters
2729

2830
git "#{Chef::Config[:file_cache_path]}/prometheus-#{node['prometheus']['version']}" do
2931
repository node['prometheus']['source']['git_repository']
@@ -33,7 +35,8 @@
3335

3436
bash 'compile_prometheus_source' do
3537
cwd "#{Chef::Config[:file_cache_path]}/prometheus-#{node['prometheus']['version']}"
36-
environment 'PATH' => "/usr/local/go/bin:#{ENV['PATH']}", 'GOPATH' => "/opt/go:#{node['go']['gopath']}:/opt/go/src/github.com/prometheus/promu/vendor"
38+
environment 'PATH' => "/usr/local/go/bin:#{ENV['PATH']}",
39+
'GOPATH' => "/opt/go:#{node['go']['gopath']}:/opt/go/src/github.com/prometheus/promu/vendor"
3740
code <<-EOH
3841
make build &&
3942
mv prometheus #{node['prometheus']['dir']} &&

spec/support/matchers.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
21
def put_ark(resource_name)
32
ChefSpec::Matchers::ResourceMatcher.new(:ark, :put, resource_name)
43
end
4+
5+
def build_essential(resource_name)
6+
ChefSpec::Matchers::ResourceMatcher.new(:build_essential, :install, resource_name)
7+
end

0 commit comments

Comments
 (0)