qa_server 7.7.0 → 7.7.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0978259611a921fa54a761892e41d7248f1176274534d2760501abe367beeaa
|
4
|
+
data.tar.gz: 2db5881b75ef09978b4ed2a26c6f80aa18e7b18d5f947df8b3d0c2062672082b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a25a399d6ac07235da877181c581307e80dbd8c562f3af789ddc580e14480520da1a3dd2201c5a1c631aba5b2f4d7f79172a2acb456348b763626abfaa79c40b
|
7
|
+
data.tar.gz: 023bbcb131e44ed281222c6b85a8e67028612027c11a4a432d3f99115ee0223b359a48c82892710b329958fd959840c210cc2957773e85556f18f6ae974a8ff8
|
data/.rubocop_fixme.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,11 @@ module QaServer::MonitorStatus
|
|
7
7
|
|
8
8
|
# @param parent [QaServer::MonitorStatusPresenter] parent presenter
|
9
9
|
# @param historical_summary_data [Array<Hash>] summary of past failuring runs per authority to drive chart
|
10
|
+
# @example historical_summary_data
|
11
|
+
# {
|
12
|
+
# "AGROVOC_DIRECT"=>{:good=>4, :bad=>0},
|
13
|
+
# "AGROVOC_LD4L_CACHE"=>{:good=>4, :bad=>0}
|
14
|
+
# }
|
10
15
|
def initialize(parent:, historical_summary_data:)
|
11
16
|
@parent = parent
|
12
17
|
@historical_summary_data = historical_summary_data
|
@@ -14,8 +19,10 @@ module QaServer::MonitorStatus
|
|
14
19
|
|
15
20
|
# @return [Array<Hash>] historical test data to be displayed (authname, failing, passing)
|
16
21
|
# @example
|
17
|
-
#
|
18
|
-
#
|
22
|
+
# {
|
23
|
+
# "AGROVOC_DIRECT"=>{:good=>4, :bad=>0},
|
24
|
+
# "AGROVOC_LD4L_CACHE"=>{:good=>4, :bad=>0}
|
25
|
+
# }
|
19
26
|
def historical_summary
|
20
27
|
@historical_summary_data
|
21
28
|
end
|
@@ -72,47 +79,88 @@ module QaServer::MonitorStatus
|
|
72
79
|
end
|
73
80
|
end
|
74
81
|
|
82
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
83
|
+
# @return [String] name of the authority (e.g. 'AUTH_NAME')
|
84
|
+
# @example historical_entry
|
85
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
75
86
|
def historical_data_authority_name(historical_entry)
|
76
87
|
historical_entry[0]
|
77
88
|
end
|
78
89
|
|
90
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
91
|
+
# @return [Integer] number of days with passing tests (e.g. 949)
|
92
|
+
# @example historical_entry
|
93
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
79
94
|
def days_authority_passing(historical_entry)
|
80
95
|
historical_entry[1][:good]
|
81
96
|
end
|
82
97
|
|
98
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
99
|
+
# @return [Integer] number of days with failing tests (e.g. 51)
|
100
|
+
# @example historical_entry
|
101
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
83
102
|
def days_authority_failing(historical_entry)
|
84
103
|
historical_entry[1][:bad]
|
85
104
|
end
|
86
105
|
|
106
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
107
|
+
# @return [Integer] number of days tested (e.g. 1000)
|
108
|
+
# @example historical_entry
|
109
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
87
110
|
def days_authority_tested(historical_entry)
|
88
111
|
days_authority_passing(historical_entry) + days_authority_failing(historical_entry)
|
89
112
|
end
|
90
113
|
|
114
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
115
|
+
# @return [Float] percent of failing to passing tests (e.g. 0.05374 )
|
116
|
+
# @example historical_entry
|
117
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
91
118
|
def percent_authority_failing(historical_entry)
|
92
119
|
days_authority_failing(historical_entry).to_f / days_authority_tested(historical_entry)
|
93
120
|
end
|
94
121
|
|
122
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
123
|
+
# @return [String] percent of failing to passing tests (e.g. '5.4%')
|
124
|
+
# @example historical_entry
|
125
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
95
126
|
def percent_authority_failing_str(historical_entry)
|
96
127
|
ActiveSupport::NumberHelper.number_to_percentage(percent_authority_failing(historical_entry) * 100, precision: 1)
|
97
128
|
end
|
98
129
|
|
130
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
131
|
+
# @return [String] css class for background in Days Failing and Percent Failing columns (e.g. 'status-neutral', 'status-unknown', 'status-bad')
|
132
|
+
# @example historical_entry
|
133
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
99
134
|
def failure_style_class(historical_entry)
|
100
|
-
|
101
|
-
|
135
|
+
case percent_authority_failing(historical_entry)
|
136
|
+
when 0.0...CAUTION_THRESHOLD
|
137
|
+
"status-neutral"
|
138
|
+
when CAUTION_THRESHOLD...WARNING_THRESHOLD
|
139
|
+
"status-unknown"
|
140
|
+
else
|
141
|
+
"status-bad"
|
142
|
+
end
|
102
143
|
end
|
103
144
|
|
145
|
+
# @param historical_entry [Array<String,Hash>] data for a single authority including name, # passing tests (good), # failing tests (bad)
|
146
|
+
# @return [String] css class for background in Days Passing column (e.g. 'status-good', 'status-bad')
|
147
|
+
# @example historical_entry
|
148
|
+
# [ 'AUTH_NAME', { good: 949, bad: 51 } ]
|
104
149
|
def passing_style_class(historical_entry)
|
105
150
|
days_authority_passing(historical_entry) <= 0 ? "status-bad" : "status-good"
|
106
151
|
end
|
107
152
|
|
153
|
+
# @return [Boolean] true if historical section should be visible; otherwise false
|
108
154
|
def display_history_details?
|
109
155
|
display_historical_graph? || display_historical_datatable?
|
110
156
|
end
|
111
157
|
|
158
|
+
# @return [Boolean] true if historical graph should be visible; otherwise false
|
112
159
|
def display_historical_graph?
|
113
160
|
QaServer.config.display_historical_graph? && QaServer::HistoryGraphingService.history_graph_image_exists?
|
114
161
|
end
|
115
162
|
|
163
|
+
# @return [Boolean] true if historical datatable should be visible; otherwise false
|
116
164
|
def display_historical_datatable?
|
117
165
|
QaServer.config.display_historical_datatable?
|
118
166
|
end
|
data/lib/qa_server/version.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe QaServer::MonitorStatus::HistoryPresenter do
|
5
|
+
let(:presenter) { described_class.new(parent: nil, historical_summary_data: historical_summary_data) }
|
6
|
+
# rubocop:disable Layout/ExtraSpacing
|
7
|
+
let(:historical_summary_data) do
|
8
|
+
# { 'auth_name' => { good: count_of_passing_tests, bad: count_of_failing_tests } }
|
9
|
+
{
|
10
|
+
'GOOD_AUTH' => { good: 0, bad: 1000 },
|
11
|
+
'BARELY_GOOD' => { good: 49, bad: 951 },
|
12
|
+
'OK_AUTH' => { good: 50, bad: 950 },
|
13
|
+
'STILL_OK' => { good: 51, bad: 949 },
|
14
|
+
'BARELY_OK' => { good: 99, bad: 901 },
|
15
|
+
'BAD_AUTH' => { good: 100, bad: 900 },
|
16
|
+
'STILL_BAD' => { good: 101, bad: 899 },
|
17
|
+
'REALLY_BAD' => { good: 500, bad: 500 },
|
18
|
+
'HORRIBLE' => { good: 1000, bad: 0 }
|
19
|
+
}
|
20
|
+
# rubocop:enable Layout/ExtraSpacing
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.failure_style_class' do
|
24
|
+
context 'returns NEUTRAL style' do
|
25
|
+
let(:expected_css_style) { "status-neutral" }
|
26
|
+
let(:zero_failure_entry) { ['GOOD_AUTH', { good: 1000, bad: 0 }] } # rubocop:disable Layout/ExtraSpacing
|
27
|
+
let(:just_below_caution) { ['BARELY_GOOD', { good: 951, bad: 49 }] } # rubocop:disable Layout/ExtraSpacing
|
28
|
+
|
29
|
+
it 'when no failures' do
|
30
|
+
expect(presenter.failure_style_class(zero_failure_entry)).to eq expected_css_style
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'when percent of failures is just below the CAUTION_THRESHOLD' do
|
34
|
+
expect(presenter.failure_style_class(just_below_caution)).to eq expected_css_style
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'returns CAUTION style' do
|
39
|
+
let(:expected_css_style) { "status-unknown" }
|
40
|
+
let(:equal_caution) { ['OK_AUTH', { good: 950, bad: 50 }] }
|
41
|
+
let(:just_above_caution) { ['STILL_OK', { good: 949, bad: 51 }] }
|
42
|
+
let(:just_below_warning) { ['BARELY_OK', { good: 901, bad: 99 }] }
|
43
|
+
|
44
|
+
it 'when percent of failures is equal to CAUTION_THRESHOLD' do
|
45
|
+
expect(presenter.failure_style_class(equal_caution)).to eq expected_css_style
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'when percent of failures is just above CAUTION_THRESHOLD' do
|
49
|
+
expect(presenter.failure_style_class(just_above_caution)).to eq expected_css_style
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'when percent of failures is just below WARNING_THRESHOLD' do
|
53
|
+
expect(presenter.failure_style_class(just_below_warning)).to eq expected_css_style
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'returns WARNING style' do
|
58
|
+
let(:expected_css_style) { "status-bad" }
|
59
|
+
let(:equal_warning) { ['BAD_AUTH', { good: 900, bad: 100 }] }
|
60
|
+
let(:just_above_warning) { ['STILL_BAD', { good: 899, bad: 101 }] }
|
61
|
+
let(:well_above_warning) { ['REALLY_BAD', { good: 500, bad: 500 }] }
|
62
|
+
let(:all_failures) { ['HORRIBLE', { good: 0, bad: 1000 }] }
|
63
|
+
|
64
|
+
it 'when percent of failures is equal to WARNING_THRESHOLD' do
|
65
|
+
expect(presenter.failure_style_class(equal_warning)).to eq expected_css_style
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'when percent of failures is just above WARNING_THRESHOLD' do
|
69
|
+
expect(presenter.failure_style_class(just_above_warning)).to eq expected_css_style
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'when percent of failures is well above WARNING_THRESHOLD' do
|
73
|
+
expect(presenter.failure_style_class(well_above_warning)).to eq expected_css_style
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'when percent of failures is 100%' do
|
77
|
+
expect(presenter.failure_style_class(all_failures)).to eq expected_css_style
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qa_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.7.
|
4
|
+
version: 7.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E. Lynette Rayle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -546,6 +546,7 @@ files:
|
|
546
546
|
- spec/i18n_spec.rb
|
547
547
|
- spec/lib/configuration_spec.rb
|
548
548
|
- spec/lib/qa_server_spec.rb
|
549
|
+
- spec/presenters/qa_server/monitor_status/history_presenter_spec.rb
|
549
550
|
- spec/rails_helper.rb
|
550
551
|
- spec/services/qa_server/time_period_service_spec.rb
|
551
552
|
- spec/services/qa_server/time_service_spec.rb
|
@@ -584,6 +585,7 @@ test_files:
|
|
584
585
|
- spec/i18n_spec.rb
|
585
586
|
- spec/lib/configuration_spec.rb
|
586
587
|
- spec/lib/qa_server_spec.rb
|
588
|
+
- spec/presenters/qa_server/monitor_status/history_presenter_spec.rb
|
587
589
|
- spec/rails_helper.rb
|
588
590
|
- spec/services/qa_server/time_period_service_spec.rb
|
589
591
|
- spec/services/qa_server/time_service_spec.rb
|