corn 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69417032301f90d71946591f896565c78fb935dc
4
- data.tar.gz: d748f9ef157b3595f51182c823ecf33ad51ee441
3
+ metadata.gz: bd6bf050c9281d4d7466d536e0c21a742b49a54c
4
+ data.tar.gz: 85b6e57c88e13ef0e4eef17c92bc8084b2aeb0ca
5
5
  SHA512:
6
- metadata.gz: 49c41f1e71cef91dea0f00fb6eda29ca4be72cfc49dabd478654eb9a3912c08170c139a96aeea24d98de01ed8896f2d22fd24200461334ee13fde5d4380a1117
7
- data.tar.gz: 998dfbae54b00480195c2f3a964695551cab4ff0ef648ee8fffe018b9d1435a2a9bbdd08444b32e536dba8ad24f48f644da053add2cb3458fdfd65171f73db98
6
+ metadata.gz: 8397e9bf1689a62df96fd5a07e7d576ee576dd0f66c749e38f1564fb0697a6cf5d0e97ff8f5d290220c6f0f1ec1768a89de3874e11f0b4a1be71056e92a8564a
7
+ data.tar.gz: 1823d6d382275608edeace1b8114e14a48baf57ba122be4ac05d048dbffaa85eb7b77ca55739ec6a7922d5c8381f4fbb14350182a0b93909a332c4149fe29e3c
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  setup environments:
6
6
 
7
7
  CORN_CLIENT_ID
8
- CORN_BUILD_ID
8
+ CORN_BUILD_LABEL
9
9
 
10
10
  ```ruby
11
11
 
@@ -1,6 +1,7 @@
1
1
  require 'net/http'
2
2
  require 'net/https'
3
3
  require 'logger'
4
+ require 'csv'
4
5
 
5
6
  require 'corn/report'
6
7
  require 'corn/test_unit'
@@ -10,15 +11,15 @@ module Corn
10
11
  module_function
11
12
 
12
13
  def host
13
- ENV['CORN_HOST']
14
+ ENV['CORN_HOST'] || raise('No environment vairable CORN_HOST defined')
14
15
  end
15
16
 
16
17
  def client_id
17
- ENV['CORN_CLIENT_ID'] || 'corn client id'
18
+ ENV['CORN_CLIENT_ID'] || raise('No environment vairable CORN_CLIENT_ID defined')
18
19
  end
19
20
 
20
- def build_id
21
- ENV['CORN_BUILD_ID'] || 'corn build id'
21
+ def build_label
22
+ ENV['CORN_BUILD_LABEL'] || raise('No environment vairable CORN_BUILD_LABEL defined')
22
23
  end
23
24
 
24
25
  def logger
@@ -46,15 +47,31 @@ module Corn
46
47
  end
47
48
 
48
49
  def report_start
50
+ @reports ||= create_reports
49
51
  Report.new
50
52
  end
51
53
 
52
54
  def report_end(test_name, report)
55
+ @reports << [test_name] + report.records.flatten
56
+ end
57
+
58
+ def create_reports
59
+ at_exit { submit_reports }
60
+ []
61
+ end
62
+
63
+ def submit_reports
64
+ return if @reports.nil? || @reports.empty?
53
65
  log_error do
54
- head = [['client_id', client_id],
55
- ['build_id', build_id],
56
- ['test_name', test_name]]
57
- data = head.concat(report.records.map {|r| ['reports[]', r.join(",")]})
66
+ reports_csv = CSV.generate do |csv|
67
+ @reports.each do |rep|
68
+ csv << rep
69
+ end
70
+ end
71
+ data = { client_id: client_id,
72
+ build_label: build_label,
73
+ reports: reports_csv }
74
+ @reports = []
58
75
  http_post(File.join(host, 'benchmarks'), data)
59
76
  end
60
77
  end
@@ -18,7 +18,7 @@ module Corn
18
18
 
19
19
  def after_setup
20
20
  @__corn_report__.record_end
21
- @__corn_report__.record_start(__name__)
21
+ @__corn_report__.record_start(:run_test)
22
22
  end
23
23
 
24
24
  def before_teardown
@@ -18,7 +18,7 @@ module Corn
18
18
  @_result = result
19
19
  begin
20
20
  report.record(:setup) { setup }
21
- report.record(@method_name) { __send__(@method_name) }
21
+ report.record(:run_test) { __send__(@method_name) }
22
22
  rescue AssertionFailedError => e
23
23
  add_failure(e.message, e.backtrace)
24
24
  rescue Exception
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: TBD
14
14
  email: