dtk-node-agent 0.5.15 → 0.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 66132611a40d998867d1dd8ec4cd86a47d8cda1b
4
- data.tar.gz: 9ed30e7ef2172f4590367ca5c6dc21dc0ada2ad3
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZThkYzFjNTQ4ZDY3MTFiNTc1NjdlNzEyMGRiYzk3MzBkN2Y1ZmU0Yg==
5
+ data.tar.gz: !binary |-
6
+ Zjk3MTc1NTAxZDAxMThmYzYzNjAwMzczYmI0ZWIwOWIxYjFmY2ZjYg==
5
7
  SHA512:
6
- metadata.gz: b9fdae9f7469c55b728d01e974985b45d332b4264f50561f67acc76bb2130adb85e96f83c9451192909ca5838cffaed8f1c122ee63343de89eeab017d0d6e83f
7
- data.tar.gz: 2100a2a17c316444105d1722c0a3a3f41179f3ac13583282e773f3805ce6644828af911cc8bb8207b442ad64035aacac5cb66be15e85d7876780e3266619c980
8
+ metadata.gz: !binary |-
9
+ YzU5NzAyNjc1ZDFkNmIzZWM4OTUxYWZkMjNjNDA0OGFjYzZhNDM5MzViODAz
10
+ YWI0OGU3NDA2NTUxM2U0MmNmNTk4NGQ1ZDYyYjU5MWFhNDJkMDA0OTVmNGY5
11
+ Mzk2YTIzYmVmOWYwMDgwZGM0ZDc2NWNmODY2MjU2NTE2NGEzM2M=
12
+ data.tar.gz: !binary |-
13
+ YzJhYTZiNjlmY2E5ODMwMjczNDU2NTM1N2MyYzRmYzAxM2I0MjRhYmU1Zjcw
14
+ OGVhMWQyMmM5YmZjNTkyNTZiZTZkNmQwOTA4OWEyYWIwYjRhM2MwZTJmOTgw
15
+ MGY3OTZmYjc2NGY1NDAxODg2MmM5NjY4ZDRlNjYxMGMyNDAxNGI=
@@ -1,3 +1,3 @@
1
1
  module DtkNodeAgent
2
- VERSION="0.5.15"
2
+ VERSION="0.5.16"
3
3
  end
@@ -20,8 +20,12 @@ module MCollective
20
20
  json_formatter = RSpec::Core::Formatters::JsonFormatter.new(config.output)
21
21
  reporter = RSpec::Core::Reporter.new(json_formatter)
22
22
  config.instance_variable_set(:@reporter, reporter)
23
- ::RSpec::Core::Runner.run([spec_path,'--format','j'])
24
- json_formatter.output_hash
23
+ begin
24
+ ::RSpec::Core::Runner.run([spec_path,'--format','j'])
25
+ json_formatter.output_hash
26
+ rescue Exception => e
27
+ return e.message
28
+ end
25
29
  end
26
30
  end
27
31
 
@@ -65,29 +69,31 @@ module MCollective
65
69
 
66
70
  action "execute_tests_v2" do
67
71
  spec_helper = ServerSpecHelper.new
68
- all_tests = Dir["#{ModulePath}/*/#{ServerspecPath}/*.rb"]
69
72
  all_spec_results = []
70
73
 
71
74
  #Pull latest changes for modules if any
72
75
  git_server = Facts["git-server"]
73
76
 
74
- begin
75
- request[:components].each do |component|
76
- #Filter version context for modules that exist on node
77
- filtered_version_context = request[:version_context].select { |x| x[:implementation] == component[:module_name] }.first
78
- pull_modules(filtered_version_context,git_server)
77
+ request[:components].each do |component|
78
+ #Filter version context for modules that exist on node
79
+ filtered_version_context = request[:version_context].select { |x| x[:implementation] == component[:module_name] }.first
80
+ pull_modules(filtered_version_context,git_server)
79
81
 
80
- test = all_tests.select { |test| (test.include? component[:test_name]) && (test.include? component[:module_name]) }
81
- @log.info("Executing serverspec test: #{test.first}")
82
+ component_name = ""
83
+ if component[:component].include? "/"
84
+ component_name = component[:component].split("/").last
85
+ else
86
+ component_name = component[:component]
87
+ end
82
88
 
83
- spec_results = spec_helper.execute(test.first, component[:params])
84
- component_name = ""
85
- if component[:component].include? "/"
86
- component_name = component[:component].split("/").last
87
- else
88
- component_name = component[:component]
89
- end
89
+ #all_tests needs to be calculated after the pull module done
90
+ all_tests = Dir["#{ModulePath}/*/#{ServerspecPath}/*.rb"]
91
+ test = all_tests.select { |test| (test.include? component[:test_name]) && (test.include? component[:module_name]) }
92
+ @log.info("Executing serverspec test: #{test.first}")
93
+ spec_results = spec_helper.execute(test.first, component[:params])
94
+ @log.info("Serverspec results: #{spec_results}")
90
95
 
96
+ if spec_results.is_a?(Hash)
91
97
  spec_results[:examples].each do |spec|
92
98
  spec_result = {}
93
99
  spec_result.store(:module_name, component[:module_name])
@@ -96,20 +102,30 @@ module MCollective
96
102
  spec_result.store(:test_name, component[:test_name])
97
103
  spec_result.store(:test_result, spec[:full_description])
98
104
  spec_result.store(:status, spec[:status])
105
+
106
+ if spec[:status].include? "failed"
107
+ backtrace = spec[:exception][:backtrace].find { |x| x.include? component[:module_name] }
108
+ error = backtrace + " " + spec[:exception][:class] + ": " + spec[:exception][:message]
109
+ spec_result.store(:test_error, error)
110
+ end
99
111
  all_spec_results << spec_result
100
112
  end
113
+ else
114
+ spec_result = {}
115
+ spec_result.store(:module_name, component[:module_name])
116
+ spec_result.store(:component_name, component_name)
117
+ spec_result.store(:test_component_name, component[:test_component])
118
+ spec_result.store(:test_name, component[:test_name])
119
+ spec_result.store(:test_result, "N/A")
120
+ spec_result.store(:status, "failed")
121
+ spec_result.store(:test_error, spec_results)
122
+ all_spec_results << spec_result
101
123
  end
102
- reply[:data] = all_spec_results
103
- reply[:pbuilderid] = Facts["pbuilderid"]
104
- reply[:status] = :ok
105
- rescue Exception => e
106
- @log.info("Error while executing serverspec test")
107
- @log.info(e.message)
108
- reply[:data] = { :test_error => "#{e.message.lines.first}" }
109
- reply[:pbuilderid] = Facts["pbuilderid"]
110
- reply[:status] = :notok
111
124
  end
125
+ reply[:data] = all_spec_results
126
+ reply[:pbuilderid] = Facts["pbuilderid"]
127
+ reply[:status] = :ok
112
128
  end
113
129
  end
114
130
  end
115
- end
131
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtk-node-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.15
4
+ version: 0.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich PELAVIN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet
@@ -193,12 +193,12 @@ require_paths:
193
193
  - lib
194
194
  required_ruby_version: !ruby/object:Gem::Requirement
195
195
  requirements:
196
- - - '>='
196
+ - - ! '>='
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  requirements:
201
- - - '>='
201
+ - - ! '>='
202
202
  - !ruby/object:Gem::Version
203
203
  version: '0'
204
204
  requirements: []