parallelized_specs 0.4.80 → 0.4.81

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ group :dev do
7
7
  gem 'rspec', '>=2.4'
8
8
  gem 'rake'
9
9
  gem 'jeweler'
10
+ gem 'debugger'
10
11
  end
@@ -1,6 +1,13 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ columnize (0.3.6)
5
+ debugger (1.6.2)
6
+ columnize (>= 0.3.1)
7
+ debugger-linecache (~> 1.2.0)
8
+ debugger-ruby_core_source (~> 1.2.3)
9
+ debugger-linecache (1.2.0)
10
+ debugger-ruby_core_source (1.2.3)
4
11
  diff-lcs (1.1.3)
5
12
  git (1.2.5)
6
13
  jeweler (1.8.4)
@@ -27,6 +34,7 @@ PLATFORMS
27
34
  ruby
28
35
 
29
36
  DEPENDENCIES
37
+ debugger
30
38
  jeweler
31
39
  parallel
32
40
  rake
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  gem.email = "jake@instructure.com"
13
13
  gem.homepage = "http://github.com/jakesorce/#{gem.name}"
14
14
  gem.authors = "Jake Sorce, Bryan Madsen, Shawn Meredith"
15
- gem.version = "0.4.80"
15
+ gem.version = "0.4.81"
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
@@ -1,60 +1,64 @@
1
+ require 'net/http'
1
2
  require 'rubygems'
2
- require 'active_record'
3
- require 'date'
4
-
5
- ActiveRecord::Base.establish_connection(
6
- :adapter => 'yourdbtype',
7
- :host => 'yourhost',
8
- :encoding => 'utf8',
9
- :database => 'selenium_trending',
10
- :username => 'youruser',
11
- :password => 'youtpass'
12
- )
13
-
14
-
15
- class SeleniumTrend < ActiveRecord::Base
16
- ActiveRecord::Migration.class_eval do
17
- unless SeleniumTrend.table_exists?
18
- create_table :selenium_trends do |t|
19
- t.integer :hudson_build
20
- t.string :hudson_project
21
- t.string :hudson_url
22
- t.string :spec_line_failure
23
- t.string :spec_name
24
- t.string :nested_spec_name
25
- t.string :trace
26
- t.string :full_path
27
- t.string :time
28
- t.string :status
29
- t.date :date
30
- end
31
- end
32
- end
33
- end
3
+ require 'json'
4
+
5
+ @user = 'user@fireworks.boom'
6
+ @pass = 'password'
7
+ @host = 'fireworks.boom'
8
+ @port = '3456'
9
+ @post_ws = "/data/workspaces"
10
+
11
+ def build_data
34
12
 
35
- def store_failure_data
36
13
  dir = Dir.pwd
37
- data = "#{dir}/tmp/parallel_log/trends.log"
38
- File.open("#{data}", 'r') do |f|
14
+ data = "trends.log"
15
+
16
+ File.open("#{dir}/parallel_log/#{data}", 'r') do |f|
39
17
  f.each_line do |line|
40
- if values != nil
18
+ if line != nil
41
19
  values = line.split("*").to_a
42
- spec_line_failure = values[0]
20
+ spec_file = values[0]
43
21
  spec_name = values[1]
44
22
  date = values[2]
45
23
  status = values[3]
46
24
  time = values[4]
47
- nested_spec_name = values[5]
48
- trace = values[6]
49
- full_path = values[7]
50
- hudson_build = values[9]
51
- hudson_project = values[10]
52
- hudson_url = values[11]
53
-
54
- SeleniumTrend.create!(:spec_line_failure => spec_line_failure, :spec_name => spec_name, :date => date, :status => status, :time => time, :nested_spec_name => nested_spec_name, :trace => trace, :full_path => full_path, :hudson_build => hudson_build, :hudson_project => hudson_project, :hudson_url => hudson_url)
25
+ stack_trace = values[5]
26
+ spec_context = values[6]
27
+ hudson_build_number = values[7]
28
+ hudson_build_name = values[8]
29
+ gerrit_project = values[9]
30
+ git_commit_change_id = values[10]
31
+ commit_patchset_number = values[11]
32
+ build_owner = values[12]
33
+
34
+ @all_specs ||= { :build_details => { :hudson_build_number => hudson_build_number, :hudson_build_name => hudson_build_name,
35
+ :gerrit_project => gerrit_project, :git_commit_change_id => git_commit_change_id,
36
+ :commit_patchset_number => commit_patchset_number, :build_owner => build_owner }
37
+ }
38
+
39
+ @all_specs[spec_name] = { :spec_file => spec_file,
40
+ :date => date,
41
+ :status => status,
42
+ :time => time,
43
+ :stack_trace => stack_trace,
44
+ :spec_context => spec_context,
45
+ :hudson_build => hudson_build_number,
46
+ }
55
47
  end
56
48
  end
57
49
  end
50
+ @payload = @all_specs.to_json
51
+ end
52
+
53
+ def post
54
+ req = Net::HTTP::Post.new(@post_ws, initheader = {'Content-Type' =>'application/json'})
55
+ req.basic_auth @user, @pass
56
+ req.body = @payload
57
+ response = Net::HTTP.new(@host, @port).start {|http| http.request(req) }
58
+ puts "Response #{response.code} #{response.message}:
59
+ #{response.body}"
58
60
  end
59
61
 
60
- store_failure_data
62
+ build_data
63
+ thepost = post
64
+ puts thepost
@@ -15,31 +15,24 @@ class ParallelizedSpecs::TrendingExampleFailures < ParallelizedSpecs::SpecLogger
15
15
  end
16
16
 
17
17
  def example_failed(example, counter, failure)
18
- total_time = Time.now - @spec_start_time
19
- if example.location != nil
20
- @failed_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "failed*", "#{total_time}*", "#{failure.header}*", "#{failure.exception.to_s.gsub(/\n/, "")}*", "#{failure.exception.backtrace.to_s.gsub(/\n/)}*"]
18
+ if @spec_start_time ? total_time = (Time.now - @spec_start_time) : total_time = '0'
19
+ if example.location != nil
20
+ @failed_examples["#{example.location.match(/spec.*rb:\w*/).to_s}*"] = "#{example.description}*#{Date.today}*failed*#{total_time}*#{failure.exception.to_s.gsub(/\n/, "")}#{failure.exception.backtrace}*#{failure.header}*"
21
+ end
21
22
  end
22
23
  end
23
24
 
24
25
  def example_passed(example)
25
26
  total_time = Time.now - @spec_start_time
27
+ no_failure_info = '*'
26
28
  if example.location != nil
27
- @passed_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "passed*", "#{total_time}*","NA*","NA*","NA*"]
29
+ @passed_examples["#{example.location.match(/spec.*rb:\w*/).to_s}*"] = "#{example.description}*#{Date.today}*passed*#{total_time}*#{no_failure_info}*"
28
30
  end
29
31
  end
30
32
 
31
-
32
- #def example_pending(example, counter)
33
- # total_time = Time.now - @spec_start_time
34
- # if example.location != nil
35
- # @pending_examples["#{example.location.match(/spec.*\d/).to_s}*"] = ["#{example.description}*", "#{Date.today}*", "pending*", "#{total_time}*","NA*","NA*","NA*"]
36
- # end
37
- #end
38
-
39
-
40
33
  def dump_summary(*args)
41
34
  lock_output do
42
- [@failed_examples, @passed_examples].each do | example_results |
35
+ [@failed_examples, @passed_examples].each do |example_results|
43
36
  unless example_results.empty?
44
37
  (example_results).each_pair do |example, details|
45
38
  @output.puts "#{example}#{details}#{@hudson_build_info}"
@@ -49,5 +42,4 @@ class ParallelizedSpecs::TrendingExampleFailures < ParallelizedSpecs::SpecLogger
49
42
  @output.flush
50
43
  end
51
44
  end
52
- end
53
-
45
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parallelized_specs"
8
- s.version = "0.4.80"
8
+ s.version = "0.4.81"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jake Sorce, Bryan Madsen, Shawn Meredith"]
12
- s.date = "2013-11-19"
12
+ s.date = "2013-11-21"
13
13
  s.email = "jake@instructure.com"
14
14
  s.files = [
15
15
  "Gemfile",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallelized_specs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.80
4
+ version: 0.4.81
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-19 00:00:00.000000000 Z
12
+ date: 2013-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parallel