build_metrics_logger 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build_metrics_logger.rb +5 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1889f5e530180cd1d423f9a7a4e141d4af271d55
|
4
|
+
data.tar.gz: 0efe259fc5d5160a2a56109b16b31cbc9959b5ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3ec8e5e981fba709303a9fb87cb4da304d5d30ee2b68c6fc16eaf78d7199bfbb969d9ae644fec84ca67d0dbc72f63eca57ef1add0c0a02b7308a38d6603acad
|
7
|
+
data.tar.gz: eecc979901f08c2683433bf708342c2edb638a8494ece9c567fad00385eaa7a0b42c389cee42147dcb072fb2725c0372961335b4293e967dd593677e6b0d3f18
|
data/lib/build_metrics_logger.rb
CHANGED
@@ -2,11 +2,8 @@ require 'httparty'
|
|
2
2
|
|
3
3
|
class BuildMetricsLogger
|
4
4
|
def initialize(token = nil)
|
5
|
-
puts "Listener Initialized"
|
6
5
|
@token = token
|
7
6
|
@build_id = ENV.fetch('BUILD_METRICS_LOGGER_ID')
|
8
|
-
puts "Token: #{@token}"
|
9
|
-
puts "ID: #{@build_id}"
|
10
7
|
end
|
11
8
|
|
12
9
|
def start(notification)
|
@@ -31,7 +28,7 @@ class BuildMetricsLogger
|
|
31
28
|
end
|
32
29
|
|
33
30
|
def example_finished(notification)
|
34
|
-
if notification.example.metadata[:e2e] == true
|
31
|
+
if notification.example.metadata[:e2e] == true && ENV.fetch('IS_LOCAL', 'true') == 'false'
|
35
32
|
id = notification.example.id.to_s
|
36
33
|
description = notification.example.full_description.to_s
|
37
34
|
location = notification.example.location.to_s
|
@@ -47,7 +44,7 @@ class BuildMetricsLogger
|
|
47
44
|
end
|
48
45
|
|
49
46
|
def suite_finished(notification)
|
50
|
-
if notification.examples[0].metadata[:e2e] == true
|
47
|
+
if notification.examples[0].metadata[:e2e] == true && ENV.fetch('IS_LOCAL', 'true') == 'false'
|
51
48
|
time = notification.duration
|
52
49
|
passed = notification.failure_count == 0 ? true : false
|
53
50
|
build_data = {time: time, passed: passed}
|
@@ -66,7 +63,7 @@ class BuildMetricsLogger
|
|
66
63
|
end
|
67
64
|
|
68
65
|
def log_example_result(data)
|
69
|
-
|
66
|
+
HTTParty.post(example_result_url,
|
70
67
|
headers: {
|
71
68
|
"Authorization" => "Bearer #{@token}"
|
72
69
|
},
|
@@ -78,22 +75,18 @@ class BuildMetricsLogger
|
|
78
75
|
runtime: data[:time]
|
79
76
|
}
|
80
77
|
)
|
81
|
-
|
82
|
-
puts response
|
83
78
|
end
|
84
79
|
|
85
80
|
def log_build_result(data)
|
86
|
-
|
81
|
+
HTTParty.post(build_result_url,
|
87
82
|
headers: {
|
88
83
|
"Authorization" => "Bearer #{@token}"
|
89
84
|
},
|
90
85
|
body: {
|
91
86
|
passed: data[:passed],
|
92
|
-
|
87
|
+
runtime: data[:time],
|
93
88
|
build: @build_id
|
94
89
|
}
|
95
90
|
)
|
96
|
-
|
97
|
-
puts response
|
98
91
|
end
|
99
92
|
end
|