qa_server 0.1.99 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/indexing_bug.md +11 -0
- data/.github/ISSUE_TEMPLATE/new_dataset_request.md +22 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_fixme.yml +10 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +21 -15
- data/README.md +4 -0
- data/Rakefile +2 -1
- data/app/assets/stylesheets/qa_server/_home-page.scss +2 -2
- data/app/assets/stylesheets/qa_server/_styles.scss +4 -0
- data/app/controllers/qa_server/authority_list_controller.rb +3 -3
- data/app/controllers/qa_server/authority_validation_controller.rb +11 -12
- data/app/controllers/qa_server/check_status_controller.rb +6 -6
- data/app/controllers/qa_server/homepage_controller.rb +2 -2
- data/app/controllers/qa_server/monitor_status_controller.rb +32 -48
- data/app/controllers/qa_server/usage_controller.rb +2 -2
- data/app/loggers/qa_server/scenario_logger.rb +38 -42
- data/app/models/qa_server/authority_scenario.rb +1 -1
- data/app/models/qa_server/authority_status.rb +1 -0
- data/app/models/qa_server/authority_status_failure.rb +1 -0
- data/app/models/qa_server/scenario_run_history.rb +189 -0
- data/app/models/qa_server/scenario_run_registry.rb +34 -0
- data/app/models/qa_server/scenario_run_summary.rb +44 -0
- data/app/models/qa_server/scenarios.rb +15 -17
- data/app/models/qa_server/search_scenario.rb +4 -4
- data/app/models/qa_server/term_scenario.rb +2 -1
- data/app/presenters/qa_server/authority_list_presenter.rb +7 -6
- data/app/presenters/qa_server/check_status_presenter.rb +26 -16
- data/app/presenters/qa_server/monitor_status_presenter.rb +94 -38
- data/app/services/qa_server/authority_lister_service.rb +9 -9
- data/app/services/qa_server/authority_loader_service.rb +16 -15
- data/app/services/qa_server/authority_validator_service.rb +13 -13
- data/app/services/qa_server/database_migrator.rb +1 -0
- data/app/services/qa_server/scenarios_loader_service.rb +29 -27
- data/app/validators/qa_server/scenario_validator.rb +25 -35
- data/app/validators/qa_server/search_scenario_validator.rb +25 -18
- data/app/validators/qa_server/term_scenario_validator.rb +2 -1
- data/app/views/qa_server/check_status/index.html.erb +1 -1
- data/app/views/qa_server/homepage/index.html.erb +3 -3
- data/app/views/qa_server/monitor_status/index.html.erb +15 -10
- data/app/views/qa_server/usage/index.html.erb +4 -4
- data/app/views/shared/_footer.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/generators/qa_server/assets_generator.rb +1 -0
- data/lib/generators/qa_server/config_generator.rb +6 -0
- data/lib/generators/qa_server/install_generator.rb +1 -0
- data/lib/generators/qa_server/models_generator.rb +1 -0
- data/lib/generators/qa_server/templates/config/initializers/qa_server.rb +4 -0
- data/lib/generators/qa_server/templates/config/locales/qa_server.en.yml +1 -1
- data/lib/generators/qa_server/templates/db/migrate/20180807045549_create_scenario_run_registry.rb.erb +7 -0
- data/lib/generators/qa_server/templates/db/migrate/20180807045552_create_scenario_run_history.rb.erb +16 -0
- data/lib/generators/qa_server/templates/db/migrate/20180807045554_drop_unused_tables.rb.erb +6 -0
- data/lib/generators/qa_server/templates/db/migrate/20180809045552_add_indices_to_scenario_run_history.rb.erb +8 -0
- data/lib/qa_server/configuration.rb +6 -0
- data/lib/qa_server/engine.rb +10 -1
- data/lib/qa_server/version.rb +2 -1
- data/lib/qa_server.rb +19 -1
- data/lib/tasks/install.rake +1 -0
- data/lib/tasks/qa_server_tasks.rake +1 -0
- data/qa_server.gemspec +8 -5
- data/spec/rails_helper.rb +1 -0
- data/spec/spec_helper.rb +98 -98
- data/spec/test_app_templates/Gemfile.extra +2 -1
- data/tasks/qa_server_dev.rake +1 -0
- metadata +49 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb899be9f195123d4e4b12780679afac70ea5322
|
4
|
+
data.tar.gz: a12013b8d2434dae73f9d8ccf46ce0964fa95d9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52e2544fe44d77e9db9e93402caf3d922bd68bbaf1cfd02c62bd26aa5615aa68ad22836797a9fd1a8bd18891592c3c3c2be5ef5d16d452823873c1bce38e91de
|
7
|
+
data.tar.gz: 6eba1a6ffc47017d4ee5d8e5cc58e7c4bbadd84bb8bd2937483585fe520c49f0fd16a0699e6948b7e3c364620a4044a39fa30dd0823ea5bf727bcb614bb709b9
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
name: 'Indexing bug:'
|
3
|
+
about: To make requests for indexing improvements for datasets currently available in QA
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
For tracking purposes, please create a separate issue for each indexing improvement request.
|
8
|
+
|
9
|
+
- [ ] Please describe the expected performance and accuracy of a particular vocabulary.
|
10
|
+
- [ ] If applicable, please update and provide links related to existing tests, e.g. https://github.com/LD4P/qa_server/blob/master/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locgenres_ld4l_cache_validation.yml#L74-L78
|
11
|
+
- [ ] If applicable, please update the relevant tab in https://docs.google.com/spreadsheets/d/1rPvEoP9iYNkxJ0eWC8gXe3ci7e6mhW0da59xkGhadi0/edit?usp=sharing for the particular dataset in question
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
name: 'Request a New Dataset for QA:'
|
3
|
+
about: This issue template is for LD4P2 requests for a new data source to be added to QA.
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
_Please only use this issue template for LD4P2 requests for a new data source to be added to QA. If your requesting changes to how a dataset currently available in QA is treated, please use the indexing bug issue template._
|
8
|
+
|
9
|
+
__For LD4P2 partners and cohorts:__
|
10
|
+
|
11
|
+
More information about making a request can be found at https://wiki.duraspace.org/display/LD4P2/Request+a+New+Dataset+For+QA
|
12
|
+
|
13
|
+
Please perform each task listed below. (Email sf433 @ cornell dot edu with questions):
|
14
|
+
|
15
|
+
- [ ] Identify the data source: (Include the Data Source Name and its homepage URL)
|
16
|
+
- [ ] Add a new tab and indexing information for the data source to the following spreadsheet: https://docs.google.com/spreadsheets/d/1rPvEoP9iYNkxJ0eWC8gXe3ci7e6mhW0da59xkGhadi0/edit?usp=sharing.
|
17
|
+
- [ ] Add a YAML test file to https://github.com/cul-it/qa_server/tree/master/config/authorities/linked_data/scenarios; please provide here a link to the YAML file related to this request.
|
18
|
+
- See the definition of YAML keys: (link coming soon).
|
19
|
+
- YAML Example: https://github.com/cul-it/qa_server/blob/master/config/authorities/linked_data/scenarios/locgenres_ld4l_cache_validation.yml
|
20
|
+
|
21
|
+
|
22
|
+
_Please note, all requests for new data sources in QA will be prioritized by the LD4P2 project. Due to time restrictions there is no guarantee that all requests will be added to QA during the lifetime of the LD4P2 grant; regardless of resources it is still useful to know which datasets the community would find useful in such a lookup service._
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
bixby: bixby_default.yml
|
3
|
+
|
4
|
+
inherit_from: .rubocop_fixme.yml
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 2.4
|
8
|
+
DisplayCopNames: true
|
9
|
+
Exclude:
|
10
|
+
- 'db/**/*'
|
11
|
+
- 'script/**/*'
|
12
|
+
- 'spec/test_app_templates/**/*'
|
13
|
+
- 'vendor/**/*'
|
14
|
+
- 'lib/hyrax/specs/**/*'
|
15
|
+
|
16
|
+
Lint/ImplicitStringConcatenation:
|
17
|
+
Exclude:
|
18
|
+
- 'lib/generators/qa_server/**/*'
|
data/.rubocop_fixme.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Lint/RescueException:
|
2
|
+
Exclude:
|
3
|
+
- 'app/services/qa_server/scenarios_loader_service.rb'
|
4
|
+
- 'app/services/qa_server/authority_loader_service.rb'
|
5
|
+
- 'app/validators/qa_server/scenario_validator.rb'
|
6
|
+
- 'app/validators/qa_server/search_scenario_validator.rb'
|
7
|
+
|
8
|
+
Lint/UnusedMethodArgument:
|
9
|
+
Exclude:
|
10
|
+
- 'app/models/qa_server/authority_scenario.rb'
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
### 1.0.0 (2018-09-24)
|
2
|
+
|
3
|
+
* drive URL base host path from qa engine mount location
|
4
|
+
* show graph of historical data on monitor status page (prereq: ImageMagick)
|
5
|
+
* expand historical data to track all test results (passing and failing) (requires: db migrations)
|
6
|
+
* add bixby to control rubocop styles consistent with Hyrax
|
7
|
+
* add ability to use configurations to control app features
|
8
|
+
* fix security vulnerabilities
|
9
|
+
|
10
|
+
### 0.1.99 (2018-08-27)
|
11
|
+
|
12
|
+
* convert existing app code into a ruby engine
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/samvera/questioning_authority.git
|
3
|
-
revision:
|
3
|
+
revision: e870fc07b991188053d2cd9eeb6a843b896911d8
|
4
4
|
branch: min_context
|
5
5
|
specs:
|
6
|
-
qa (2.
|
6
|
+
qa (2.1.1)
|
7
7
|
activerecord-import
|
8
8
|
deprecation
|
9
9
|
faraday
|
@@ -12,12 +12,11 @@ GIT
|
|
12
12
|
rdf
|
13
13
|
|
14
14
|
PATH
|
15
|
-
remote: /Users/elr37/Documents/__DEVELOPMENT__/LD4L/_LD4L3/
|
15
|
+
remote: /Users/elr37/Documents/__DEVELOPMENT__/LD4L/_LD4L3/sprint/LD4P/qa_server
|
16
16
|
specs:
|
17
|
-
qa_server (0.
|
18
|
-
|
19
|
-
|
20
|
-
rails (= 5.1.6)
|
17
|
+
qa_server (1.0.0)
|
18
|
+
gruff
|
19
|
+
rails (~> 5.0)
|
21
20
|
|
22
21
|
GEM
|
23
22
|
remote: https://rubygems.org/
|
@@ -67,11 +66,13 @@ GEM
|
|
67
66
|
ast (2.4.0)
|
68
67
|
bcp47 (0.3.3)
|
69
68
|
i18n
|
70
|
-
better_errors (2.
|
69
|
+
better_errors (2.5.0)
|
71
70
|
coderay (>= 1.0.0)
|
72
71
|
erubi (>= 1.0.0)
|
73
72
|
rack (>= 0.9.0)
|
74
73
|
bindex (0.5.0)
|
74
|
+
binding_of_caller (0.8.0)
|
75
|
+
debug_inspector (>= 0.0.1)
|
75
76
|
bixby (1.0.0)
|
76
77
|
rubocop (~> 0.50, <= 0.52.1)
|
77
78
|
rubocop-rspec (~> 1.22, <= 1.22.2)
|
@@ -97,6 +98,7 @@ GEM
|
|
97
98
|
concurrent-ruby (1.0.5)
|
98
99
|
connection_pool (2.2.2)
|
99
100
|
crass (1.0.4)
|
101
|
+
debug_inspector (0.0.3)
|
100
102
|
deprecation (1.0.0)
|
101
103
|
activesupport
|
102
104
|
diff-lcs (1.3)
|
@@ -110,11 +112,13 @@ GEM
|
|
110
112
|
nokogiri (>= 1.4.3)
|
111
113
|
erubi (1.7.1)
|
112
114
|
execjs (2.7.0)
|
113
|
-
faraday (0.15.
|
115
|
+
faraday (0.15.3)
|
114
116
|
multipart-post (>= 1.2, < 3)
|
115
117
|
ffi (1.9.25)
|
116
118
|
globalid (0.4.1)
|
117
119
|
activesupport (>= 4.2.0)
|
120
|
+
gruff (0.7.0)
|
121
|
+
rmagick (~> 2.13, >= 2.13.4)
|
118
122
|
haml (5.0.4)
|
119
123
|
temple (>= 0.8.0)
|
120
124
|
tilt
|
@@ -277,6 +281,7 @@ GEM
|
|
277
281
|
rdf (~> 3.0)
|
278
282
|
rdf-xsd (3.0.0)
|
279
283
|
rdf (~> 3.0)
|
284
|
+
rmagick (2.16.0)
|
280
285
|
rspec-activemodel-mocks (1.0.3)
|
281
286
|
activemodel (>= 3.0)
|
282
287
|
activesupport (>= 3.0)
|
@@ -312,8 +317,8 @@ GEM
|
|
312
317
|
rubocop (>= 0.52.1)
|
313
318
|
ruby-progressbar (1.10.0)
|
314
319
|
ruby_dep (1.5.0)
|
315
|
-
rubyzip (1.2.
|
316
|
-
sass (3.
|
320
|
+
rubyzip (1.2.2)
|
321
|
+
sass (3.6.0)
|
317
322
|
sass-listen (~> 4.0.0)
|
318
323
|
sass-listen (4.0.0)
|
319
324
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -335,7 +340,7 @@ GEM
|
|
335
340
|
rdf-xsd (>= 2.2, < 4.0)
|
336
341
|
sparql (>= 2.2, < 4.0)
|
337
342
|
sxp (~> 1.0)
|
338
|
-
sparql (3.0.
|
343
|
+
sparql (3.0.2)
|
339
344
|
builder (~> 3.2)
|
340
345
|
ebnf (~> 1.1)
|
341
346
|
rdf (~> 3.0)
|
@@ -365,10 +370,10 @@ GEM
|
|
365
370
|
turbolinks-source (5.2.0)
|
366
371
|
tzinfo (1.2.5)
|
367
372
|
thread_safe (~> 0.1)
|
368
|
-
uglifier (4.1.
|
373
|
+
uglifier (4.1.19)
|
369
374
|
execjs (>= 0.3.0, < 3)
|
370
375
|
unicode-display_width (1.4.0)
|
371
|
-
web-console (3.
|
376
|
+
web-console (3.7.0)
|
372
377
|
actionview (>= 5.0)
|
373
378
|
activemodel (>= 5.0)
|
374
379
|
bindex (>= 0.4.0)
|
@@ -384,6 +389,7 @@ PLATFORMS
|
|
384
389
|
|
385
390
|
DEPENDENCIES
|
386
391
|
better_errors
|
392
|
+
binding_of_caller
|
387
393
|
bixby (~> 1.0.0)
|
388
394
|
byebug
|
389
395
|
capybara (~> 2.13)
|
@@ -408,4 +414,4 @@ DEPENDENCIES
|
|
408
414
|
web-console (>= 3.3.0)
|
409
415
|
|
410
416
|
BUNDLED WITH
|
411
|
-
1.16.
|
417
|
+
1.16.5
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Controller for Authorities header menu item
|
2
3
|
module QaServer
|
3
|
-
class AuthorityListController < AuthorityValidationController
|
4
|
-
|
4
|
+
class AuthorityListController < QaServer::AuthorityValidationController
|
5
5
|
class_attribute :presenter_class
|
6
|
-
self.presenter_class = AuthorityListPresenter
|
6
|
+
self.presenter_class = QaServer::AuthorityListPresenter
|
7
7
|
|
8
8
|
# Sets up presenter with data to display in the UI
|
9
9
|
def index
|
@@ -1,21 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module QaServer
|
2
3
|
class AuthorityValidationController < ApplicationController
|
3
4
|
layout 'qa_server'
|
4
5
|
|
5
|
-
attr_reader :status_data
|
6
|
-
|
7
6
|
class_attribute :validator_class,
|
8
7
|
:lister_class,
|
9
8
|
:logger_class
|
10
9
|
|
11
|
-
self.validator_class = AuthorityValidatorService
|
12
|
-
self.lister_class = AuthorityListerService
|
13
|
-
self.logger_class = ScenarioLogger
|
10
|
+
self.validator_class = QaServer::AuthorityValidatorService
|
11
|
+
self.lister_class = QaServer::AuthorityListerService
|
12
|
+
self.logger_class = QaServer::ScenarioLogger
|
14
13
|
|
15
14
|
VALIDATION_TYPE_PARAM = :validation_type
|
16
|
-
VALIDATE_CONNECTIONS = 'connections'
|
17
|
-
VALIDATE_ACCURACY = 'accuracy'
|
18
|
-
ALL_VALIDATIONS = 'all_checks'
|
15
|
+
VALIDATE_CONNECTIONS = 'connections'
|
16
|
+
VALIDATE_ACCURACY = 'accuracy'
|
17
|
+
ALL_VALIDATIONS = 'all_checks'
|
19
18
|
DEFAULT_VALIDATION_TYPE = validator_class::VALIDATE_CONNECTIONS
|
20
19
|
|
21
20
|
private
|
@@ -62,12 +61,12 @@ module QaServer
|
|
62
61
|
|
63
62
|
def validation_type
|
64
63
|
return @validation_type if @validation_type.present?
|
65
|
-
case
|
66
|
-
when
|
64
|
+
case params[VALIDATION_TYPE_PARAM]
|
65
|
+
when ALL_VALIDATIONS
|
67
66
|
validator_class::ALL_VALIDATIONS
|
68
|
-
when
|
67
|
+
when VALIDATE_CONNECTIONS
|
69
68
|
validator_class::VALIDATE_CONNECTIONS
|
70
|
-
when
|
69
|
+
when VALIDATE_ACCURACY
|
71
70
|
validator_class::VALIDATE_ACCURACY
|
72
71
|
else
|
73
72
|
DEFAULT_VALIDATION_TYPE
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Controller for Check Status header menu item
|
2
3
|
module QaServer
|
3
|
-
class CheckStatusController < AuthorityValidationController
|
4
|
-
|
5
|
-
ALL_AUTHORITIES = '__all__'.freeze
|
4
|
+
class CheckStatusController < QaServer::AuthorityValidationController
|
5
|
+
ALL_AUTHORITIES = '__all__'
|
6
6
|
|
7
7
|
class_attribute :presenter_class
|
8
|
-
self.presenter_class = CheckStatusPresenter
|
8
|
+
self.presenter_class = QaServer::CheckStatusPresenter
|
9
9
|
|
10
10
|
# Sets up presenter with data to display in the UI
|
11
11
|
def index
|
@@ -27,12 +27,12 @@ module QaServer
|
|
27
27
|
|
28
28
|
def authorities_to_validate
|
29
29
|
return [] unless authority_name.present?
|
30
|
-
|
30
|
+
authority_name == ALL_AUTHORITIES ? authorities_list : [authority_name]
|
31
31
|
end
|
32
32
|
|
33
33
|
def authority_name
|
34
34
|
return @authority_name if @authority_name.present?
|
35
|
-
@authority_name = (params.key? :authority) ? params[:authority].downcase : nil
|
35
|
+
@authority_name = (params.key? :authority) ? params[:authority].downcase : nil # rubocop:disable Style/TernaryParentheses
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -1,75 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Controller for Monitor Status header menu item
|
2
3
|
module QaServer
|
3
|
-
class MonitorStatusController < AuthorityValidationController
|
4
|
-
|
4
|
+
class MonitorStatusController < QaServer::AuthorityValidationController
|
5
5
|
class_attribute :presenter_class,
|
6
|
-
:
|
7
|
-
:
|
6
|
+
:scenario_run_registry_class,
|
7
|
+
:scenario_history_class
|
8
8
|
|
9
|
-
self.presenter_class = MonitorStatusPresenter
|
10
|
-
self.
|
11
|
-
self.
|
9
|
+
self.presenter_class = QaServer::MonitorStatusPresenter
|
10
|
+
self.scenario_run_registry_class = QaServer::ScenarioRunRegistry
|
11
|
+
self.scenario_history_class = QaServer::ScenarioRunHistory
|
12
12
|
|
13
13
|
# Sets up presenter with data to display in the UI
|
14
14
|
def index
|
15
|
-
|
16
|
-
if refresh? || expired_status? || authority_status.blank?
|
15
|
+
if refresh? || expired?
|
17
16
|
validate(authorities_list)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
current_data: @status_data,
|
27
|
-
historical_data: [])
|
28
|
-
render 'index', :status => :internal_server_error if authority_status.failure_count.positive?
|
17
|
+
update_summary_and_data
|
18
|
+
end
|
19
|
+
# TODO: Include historical data and performance data too
|
20
|
+
@presenter = presenter_class.new(current_summary: latest_summary,
|
21
|
+
current_failure_data: latest_failures,
|
22
|
+
historical_summary_data: historical_summary_data,
|
23
|
+
performance_data: [])
|
24
|
+
render 'index', status: :internal_server_error if latest_summary.failing_authority_count.positive?
|
29
25
|
end
|
30
26
|
|
31
27
|
private
|
32
28
|
|
33
|
-
def
|
34
|
-
@
|
35
|
-
@latest_authority_status ||= authority_status_model_class.latest
|
29
|
+
def latest_run
|
30
|
+
@latest_run ||= scenario_run_registry_class.latest_run
|
36
31
|
end
|
37
32
|
|
38
|
-
def
|
39
|
-
|
40
|
-
@status_data = status_data_from_log
|
33
|
+
def latest_summary
|
34
|
+
@latest_summary ||= scenario_history_class.run_summary(scenario_run: latest_run)
|
41
35
|
end
|
42
36
|
|
43
|
-
def
|
44
|
-
@
|
45
|
-
test_count: status_log.test_count,
|
46
|
-
failure_count: status_log.failure_count)
|
47
|
-
status_log.to_a.each { |failure| save_authority_status_failure(@latest_authority_status, failure) }
|
37
|
+
def latest_failures
|
38
|
+
@status_data ||= scenario_history_class.run_failures(run_id: latest_run.id)
|
48
39
|
end
|
49
40
|
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
authority_name: failure[:authority_name].to_s,
|
55
|
-
subauthority_name: failure[:subauthority_name],
|
56
|
-
service: failure[:service],
|
57
|
-
action: failure[:action],
|
58
|
-
url: failure[:url],
|
59
|
-
err_message: failure[:err_message])
|
41
|
+
def update_summary_and_data
|
42
|
+
scenario_run_registry_class.save_run(scenarios_results: status_log.to_a)
|
43
|
+
@latest_summary = nil # reset so next request recalculates
|
44
|
+
@latest_failures = nil # reset so next request recalculates
|
60
45
|
end
|
61
46
|
|
62
|
-
def
|
63
|
-
|
64
|
-
status.blank? || status.dt_stamp < yesterday_midnight_et
|
47
|
+
def historical_summary_data
|
48
|
+
@historical_summary_data ||= scenario_history_class.historical_summary
|
65
49
|
end
|
66
50
|
|
67
|
-
def
|
68
|
-
|
51
|
+
def expired?
|
52
|
+
latest_summary.blank? || latest_summary.run_dt_stamp < yesterday_midnight_et
|
69
53
|
end
|
70
54
|
|
71
|
-
def
|
72
|
-
|
55
|
+
def yesterday_midnight_et
|
56
|
+
(DateTime.yesterday.midnight.to_time + 4.hours).to_datetime.in_time_zone("Eastern Time (US & Canada)")
|
73
57
|
end
|
74
58
|
|
75
59
|
def refresh?
|
@@ -1,11 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Provide a log of scenario data and test results
|
2
3
|
module QaServer
|
3
4
|
class ScenarioLogger
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# @return the number of scenarios recorded in the log
|
8
|
+
delegate :size, :each, to: :@log
|
9
|
+
|
4
10
|
attr_reader :test_count, :failure_count
|
5
11
|
|
6
|
-
PASS = ScenarioValidator::PASS
|
7
|
-
FAIL = ScenarioValidator::FAIL
|
8
|
-
UNKNOWN = ScenarioValidator::UNKNOWN
|
12
|
+
PASS = QaServer::ScenarioValidator::PASS
|
13
|
+
FAIL = QaServer::ScenarioValidator::FAIL
|
14
|
+
UNKNOWN = QaServer::ScenarioValidator::UNKNOWN
|
9
15
|
|
10
16
|
def initialize(test_count = 0, failure_count = 0)
|
11
17
|
@log = []
|
@@ -14,41 +20,36 @@ module QaServer
|
|
14
20
|
end
|
15
21
|
|
16
22
|
# Add a scenario to the log
|
17
|
-
# @param
|
18
|
-
# @
|
19
|
-
# @
|
20
|
-
# @
|
21
|
-
# @
|
22
|
-
# @
|
23
|
-
# @
|
24
|
-
# @
|
25
|
-
# @
|
26
|
-
# @
|
27
|
-
# @
|
28
|
-
|
23
|
+
# @param [Hash] status_info holding information to be logged
|
24
|
+
# @option authority_name [String] name of the authority the scenario was run against
|
25
|
+
# @option status [Symbol] indicating whether the scenario passed, failed, or has unknown status (see PASS, FAIL, UNKNOWN constants)
|
26
|
+
# @option validation_type [Symbol] the type of validation this status data describes (e.g. :connection, :accuracy)
|
27
|
+
# @option subauth [String] name of the subauthority the scenario was run against
|
28
|
+
# @option service [String] identifies the primary service provider (e.g. 'ld4l_cache', 'direct', etc.)
|
29
|
+
# @option action [String] type of scenario (i.e. 'term', 'search')
|
30
|
+
# @option url [String] example url that was used to test a specific term fetch or search query
|
31
|
+
# @option error_message [String] error message if scenario failed
|
32
|
+
# @option expected [Integer] the expected result (e.g. min size of result OR max position of subject within results)
|
33
|
+
# @option actual [Integer] the actual result (e.g. actual size of results OR actual position of subject within results)
|
34
|
+
# @option target [String] the expected target that was validated (e.g. subject_uri for query, pref label for term fetch)
|
35
|
+
# @option request_run_time [BigDecimal] the amount of time to retrieve data from the authority
|
36
|
+
# @option normalization_run_time [BigDecimal] the amount of time to normalize the retrieved data into json
|
37
|
+
def add(status_info) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
29
38
|
@test_count += 1
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
subauthority_name: subauth,
|
45
|
-
service: service,
|
46
|
-
action: action,
|
47
|
-
url: url,
|
48
|
-
expected: expected,
|
49
|
-
actual: actual,
|
50
|
-
target: target,
|
51
|
-
err_message: error_message }
|
39
|
+
@failure_count += 1 unless status_info[:status] == PASS
|
40
|
+
@log << { type: status_info[:validation_type] || '',
|
41
|
+
status: status_info[:status] || '',
|
42
|
+
authority_name: status_info[:authority_name] || '',
|
43
|
+
subauthority_name: status_info[:subauth] || '',
|
44
|
+
service: status_info[:service] || '',
|
45
|
+
action: status_info[:action] || '',
|
46
|
+
url: status_info[:url] || '',
|
47
|
+
expected: status_info[:expected] || nil,
|
48
|
+
actual: status_info[:actual] || nil,
|
49
|
+
target: status_info[:target] || nil,
|
50
|
+
err_message: status_info[:error_message] || '',
|
51
|
+
request_run_time: status_info[:request_run_time] || nil,
|
52
|
+
normalization_run_time: status_info[:normalization_run_time] || nil }
|
52
53
|
end
|
53
54
|
|
54
55
|
# Delete from the log any tests that passed.
|
@@ -75,10 +76,5 @@ module QaServer
|
|
75
76
|
def to_a
|
76
77
|
@log
|
77
78
|
end
|
78
|
-
|
79
|
-
# @return the number of scenarios recorded in the log
|
80
|
-
def size
|
81
|
-
to_a.size
|
82
|
-
end
|
83
79
|
end
|
84
80
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Abstract class that parses the authority configuration from the yml file into the parts needed by inheriting scenario types.
|
2
3
|
module QaServer
|
3
4
|
class AuthorityScenario
|
4
|
-
|
5
5
|
# @return [Qa::Authorities::LinkedData::GenericAuthority] authority instance the scenarios run against
|
6
6
|
attr_reader :authority
|
7
7
|
|