qa_server 0.1.99 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,3 +1,5 @@
|
|
1
|
+
<%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
|
2
|
+
|
1
3
|
<div class="page-description">
|
2
4
|
<h2><%= t('qa_server.monitor_status.summary.title') %></h2>
|
3
5
|
|
@@ -36,7 +38,7 @@
|
|
36
38
|
</tr>
|
37
39
|
<% @status_data.each do |status| %>
|
38
40
|
<tr>
|
39
|
-
<td class="<%=
|
41
|
+
<td class="<%= @presenter.status_style_class(status) %>"><%= @presenter.status_label(status) %></td>
|
40
42
|
<td><%= status[:authority_name] %></td>
|
41
43
|
<td><%= status[:subauthority_name] %></td>
|
42
44
|
<td><%= status[:service] %></td>
|
@@ -52,9 +54,11 @@
|
|
52
54
|
<% if @presenter.history? %>
|
53
55
|
<div id="status-section" class="status-section">
|
54
56
|
<h2><%= t('qa_server.monitor_status.history.title') %></h2>
|
57
|
+
<p class="status-update-dtstamp"><%= t('qa_server.monitor_status.history.since', date: @presenter.first_updated) %></p>
|
58
|
+
<%#= column_chart @presenter.historical_summary, stacked: true, colors: ["green", "red"], xtitle: 'Authority', ytitle: 'Pass-Fail', legend: 'bottom' %>
|
59
|
+
<%= image_tag(@presenter.historical_graph, alt: 'History Graph Unavailable') %>
|
55
60
|
|
56
|
-
|
57
|
-
|
61
|
+
<!--
|
58
62
|
<table class="status">
|
59
63
|
<tr>
|
60
64
|
<th><%= t('qa_server.monitor_status.history.days_failing') %></th>
|
@@ -63,16 +67,17 @@
|
|
63
67
|
<th><%= t('qa_server.monitor_status.history.service') %></th>
|
64
68
|
<th><%= t('qa_server.monitor_status.history.action') %></th>
|
65
69
|
</tr>
|
66
|
-
|
70
|
+
<%# @presenter.history.each do |entry| %>
|
67
71
|
<tr>
|
68
|
-
<td
|
69
|
-
<td
|
70
|
-
<td
|
71
|
-
<td
|
72
|
-
<td
|
72
|
+
<td><%#= entry[:days_failing] %></td>
|
73
|
+
<td><%#= entry[:authority_name] %></td>
|
74
|
+
<td><%#= entry[:subauthority_name] %></td>
|
75
|
+
<td><%#= entry[:service] %></td>
|
76
|
+
<td><%#= entry[:action] %></td>
|
73
77
|
</tr>
|
74
|
-
|
78
|
+
<%# end %>
|
75
79
|
</table>
|
80
|
+
-->
|
76
81
|
</div>
|
77
82
|
<% end %>
|
78
83
|
</div>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
optional parameters, but attempts were made to keep optional parameter names consistent between authorities.</p>
|
8
8
|
|
9
9
|
<h4>Without subauthority:</h4>
|
10
|
-
<pre
|
10
|
+
<pre><%= QaServer::Engine.qa_engine_mount %>/search/linked_data/locnames_ld4l_cache?q=mark%20twain&maxRecords=4&lang=en</pre>
|
11
11
|
|
12
12
|
where,
|
13
13
|
<ul>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
</ul>
|
20
20
|
|
21
21
|
<h4>With subauthority</h4>
|
22
|
-
<pre
|
22
|
+
<pre><%= QaServer::Engine.qa_engine_mount %>/search/linked_data/locnames_ld4l_cache/person?q=mark%20twain&maxRecords=4&lang=en</pre>
|
23
23
|
|
24
24
|
where,
|
25
25
|
<ul>
|
@@ -59,7 +59,7 @@
|
|
59
59
|
consistent between authorities.</p>
|
60
60
|
|
61
61
|
<h4>Fetch by URI</h4>
|
62
|
-
<pre
|
62
|
+
<pre><%= QaServer::Engine.qa_engine_mount %>/show/linked_data/locnames_ld4l_cache/http%3A%2F%2Fid%2Eloc%2Egov%2Fauthorities%2Fnames%2Fn92016188</pre>
|
63
63
|
<p><b><%= t('qa_server.warning.chrome_unencoding_msg') %></b></p>
|
64
64
|
|
65
65
|
where,
|
@@ -71,7 +71,7 @@
|
|
71
71
|
</ul>
|
72
72
|
|
73
73
|
<h4>Fetch by ID</h4>
|
74
|
-
<pre
|
74
|
+
<pre><%= QaServer::Engine.qa_engine_mount %>/show/linked_data/oclcfast_ld4l_cache/1914919?lang=en</pre>
|
75
75
|
|
76
76
|
where,
|
77
77
|
<ul>
|
data/config/routes.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rails/generators'
|
2
3
|
|
3
4
|
class QaServer::ConfigGenerator < Rails::Generators::Base
|
@@ -8,6 +9,7 @@ class QaServer::ConfigGenerator < Rails::Generators::Base
|
|
8
9
|
* authority configs
|
9
10
|
* authority scenarios
|
10
11
|
* i18n
|
12
|
+
* add default configuration initializer
|
11
13
|
"""
|
12
14
|
|
13
15
|
def banner
|
@@ -28,4 +30,8 @@ class QaServer::ConfigGenerator < Rails::Generators::Base
|
|
28
30
|
say_status('info', ' -- adding i18n translations', :blue)
|
29
31
|
copy_file 'config/locales/qa_server.en.yml'
|
30
32
|
end
|
33
|
+
|
34
|
+
def create_initializer_config_file
|
35
|
+
copy_file 'config/initializers/qa_server.rb'
|
36
|
+
end
|
31
37
|
end
|
@@ -6,4 +6,4 @@ en:
|
|
6
6
|
footer:
|
7
7
|
copyright_html: "<strong>Copyright © 2018 Cornell</strong> Licensed under the Apache License, Version 2.0"
|
8
8
|
service_html: A service of <a href="http://www.library.cornell.edu/" class="navbar-link" target="_blank">Cornell University Library</a> and <br /><a href="https://www.slis.uiowa.edu/" class="navbar-link" target="_blank">School of Library and Information Science, University of Iowa</a>.
|
9
|
-
|
9
|
+
attribution_html: This service is supported by work on <a href="http://ld4l.org" class="navbar-link" target="_blank">Linked Data for Libraries - Labs</a> and <br> <a href="https://wiki.duraspace.org/x/9xgRBg" class="navbar-link" target="_blank">Linked Data for Production</a> funded by <a href="https://mellon.org/" class="navbar-link" target="_blank">Andrew W. Mellon Foundation</a>, <br>and by work on Questioning Authority in <a href="http://samvera.org" class="navbar-link" target="_blank">Samvera</a>, an open source community.
|
data/lib/generators/qa_server/templates/db/migrate/20180807045552_create_scenario_run_history.rb.erb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateScenarioRunHistory < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
create_table :scenario_run_history do |t|
|
4
|
+
t.belongs_to :scenario_run_registry
|
5
|
+
t.integer :status, default: 2 # :good, :bad, :unknown
|
6
|
+
t.string :authority_name
|
7
|
+
t.string :subauthority_name
|
8
|
+
t.string :service
|
9
|
+
t.string :action
|
10
|
+
t.string :url
|
11
|
+
t.string :err_message
|
12
|
+
t.integer :scenario_type, default: 0 # :connection, :accuracy, :performance
|
13
|
+
t.decimal :run_time, precision: 10, scale: 4
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddIndicesToScenarioRunHistory < ActiveRecord::Migration<%= migration_version %>
|
2
|
+
def change
|
3
|
+
add_index :scenario_run_history, :url
|
4
|
+
add_index :scenario_run_history, :status
|
5
|
+
add_index :scenario_run_history, :authority_name
|
6
|
+
add_index :scenario_run_history, :scenario_type
|
7
|
+
end
|
8
|
+
end
|
data/lib/qa_server/engine.rb
CHANGED
@@ -1,12 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module QaServer
|
2
3
|
class Engine < ::Rails::Engine
|
3
4
|
isolate_namespace QaServer
|
4
5
|
|
5
6
|
require 'qa'
|
6
7
|
|
8
|
+
def self.engine_mount
|
9
|
+
QaServer::Engine.routes.find_script_name({})
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.qa_engine_mount
|
13
|
+
Qa::Engine.routes.find_script_name({})
|
14
|
+
end
|
15
|
+
|
7
16
|
# Force these models to be added to Legato's registry in development mode
|
8
17
|
config.eager_load_paths += %W[
|
9
|
-
|
18
|
+
#{config.root}/app/models/qa_server/download.rb
|
10
19
|
#{config.root}/app/models/qa_server/pageview.rb
|
11
20
|
]
|
12
21
|
|
data/lib/qa_server/version.rb
CHANGED
data/lib/qa_server.rb
CHANGED
@@ -1,6 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'qa_server/engine'
|
2
3
|
require 'qa_server/version'
|
3
4
|
|
4
5
|
module QaServer
|
5
|
-
|
6
|
+
extend ActiveSupport::Autoload
|
7
|
+
|
8
|
+
autoload :Configuration
|
9
|
+
|
10
|
+
# @api public
|
11
|
+
#
|
12
|
+
# Exposes the Questioning Authority configuration
|
13
|
+
#
|
14
|
+
# @yield [Qa::Configuration] if a block is passed
|
15
|
+
# @return [Qa::Configuration]
|
16
|
+
# @see Qa::Configuration for configuration options
|
17
|
+
def self.config(&block)
|
18
|
+
@config ||= QaServer::Configuration.new
|
19
|
+
|
20
|
+
yield @config if block
|
21
|
+
|
22
|
+
@config
|
23
|
+
end
|
6
24
|
end
|
data/lib/tasks/install.rake
CHANGED
data/qa_server.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
lib = File.expand_path('../lib', __FILE__)
|
2
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
4
|
require 'qa_server/version'
|
@@ -18,17 +19,19 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.version = QaServer::VERSION
|
19
20
|
spec.license = 'Apache-2.0'
|
20
21
|
|
21
|
-
# spec.required_ruby_version = '>= 2.3'
|
22
|
-
|
23
22
|
# Note: rails does not follow sem-ver conventions, it's
|
24
23
|
# minor version releases can include breaking changes; see
|
25
24
|
# http://guides.rubyonrails.org/maintenance_policy.html
|
26
|
-
spec.add_dependency 'rails', '5.
|
25
|
+
spec.add_dependency 'rails', '~> 5.0' # Keep in sync with version supported by Hyrax
|
27
26
|
|
28
27
|
# Required gems for QA and linked data access
|
29
|
-
spec.
|
30
|
-
spec.
|
28
|
+
spec.add_development_dependency 'qa' # loaded specific branch in Gemfile
|
29
|
+
spec.add_development_dependency 'linkeddata'
|
30
|
+
|
31
|
+
# Produces dashboard charts on monitor status page
|
32
|
+
spec.add_dependency 'gruff'
|
31
33
|
|
34
|
+
spec.add_development_dependency 'binding_of_caller', '~> 1.0.0' # rubocop styleguide
|
32
35
|
spec.add_development_dependency 'bixby', '~> 1.0.0' # rubocop styleguide
|
33
36
|
# spec.add_development_dependency 'capybara', '~> 2.13'
|
34
37
|
spec.add_development_dependency 'engine_cart', '~> 2.0'
|
data/spec/rails_helper.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
ENV["RAILS_ENV"] ||= 'test'
|
2
3
|
require "bundler/setup"
|
3
4
|
|
@@ -183,101 +184,100 @@ end
|
|
183
184
|
# end
|
184
185
|
# end
|
185
186
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
end
|
187
|
+
# config.include(ControllerLevelHelpers, type: :view)
|
188
|
+
# config.before(:each, type: :view) { initialize_controller_helpers(view) }
|
189
|
+
#
|
190
|
+
# config.before(:all, type: :feature) do
|
191
|
+
# # Assets take a long time to compile. This causes two problems:
|
192
|
+
# # 1) the profile will show the first feature test taking much longer than it
|
193
|
+
# # normally would.
|
194
|
+
# # 2) The first feature test will trigger rack-timeout
|
195
|
+
# #
|
196
|
+
# # Precompile the assets to prevent these issues.
|
197
|
+
# visit "/assets/application.css"
|
198
|
+
# visit "/assets/application.js"
|
199
|
+
# end
|
200
|
+
#
|
201
|
+
# config.after do
|
202
|
+
# DatabaseCleaner.clean
|
203
|
+
# end
|
204
|
+
#
|
205
|
+
# # If true, the base class of anonymous controllers will be inferred
|
206
|
+
# # automatically. This will be the default behavior in future versions of
|
207
|
+
# # rspec-rails.
|
208
|
+
# config.infer_base_class_for_anonymous_controllers = false
|
209
|
+
#
|
210
|
+
# config.include Shoulda::Matchers::Independent
|
211
|
+
#
|
212
|
+
# if Devise::VERSION >= '4.2'
|
213
|
+
# config.include Devise::Test::ControllerHelpers, type: :controller
|
214
|
+
# else
|
215
|
+
# config.include Devise::TestHelpers, type: :controller
|
216
|
+
# end
|
217
|
+
#
|
218
|
+
# config.include EngineRoutes, type: :controller
|
219
|
+
# config.include Warden::Test::Helpers, type: :request
|
220
|
+
# config.include Warden::Test::Helpers, type: :feature
|
221
|
+
# config.after(:each, type: :feature) do
|
222
|
+
# Warden.test_reset!
|
223
|
+
# Capybara.reset_sessions!
|
224
|
+
# page.driver.reset!
|
225
|
+
# end
|
226
|
+
#
|
227
|
+
# config.include Capybara::RSpecMatchers, type: :input
|
228
|
+
# config.include InputSupport, type: :input
|
229
|
+
# config.include FactoryBot::Syntax::Methods
|
230
|
+
# config.include OptionalExample
|
231
|
+
#
|
232
|
+
# config.infer_spec_type_from_file_location!
|
233
|
+
#
|
234
|
+
# config.expect_with :rspec do |expectations|
|
235
|
+
# expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
236
|
+
# end
|
237
|
+
#
|
238
|
+
# config.formatter = 'LoggingFormatter'
|
239
|
+
# config.default_formatter = 'doc' if config.files_to_run.one?
|
240
|
+
#
|
241
|
+
# config.order = :random
|
242
|
+
# Kernel.srand config.seed
|
243
|
+
#
|
244
|
+
# config.shared_context_metadata_behavior = :apply_to_host_groups
|
245
|
+
#
|
246
|
+
# config.filter_run_when_matching :focus
|
247
|
+
#
|
248
|
+
# config.example_status_persistence_file_path = 'spec/examples.txt'
|
249
|
+
#
|
250
|
+
# config.profile_examples = 10
|
251
|
+
#
|
252
|
+
# # Use this example metadata when you want to perform jobs inline during testing.
|
253
|
+
# #
|
254
|
+
# # describe '#my_method`, :perform_enqueued do
|
255
|
+
# # ...
|
256
|
+
# # end
|
257
|
+
# #
|
258
|
+
# # If you pass an `Array` of job classes, they will be treated as the filter list.
|
259
|
+
# #
|
260
|
+
# # describe '#my_method`, perform_enqueued: [MyJobClass] do
|
261
|
+
# # ...
|
262
|
+
# # end
|
263
|
+
# #
|
264
|
+
# # Limit to specific job classes with:
|
265
|
+
# #
|
266
|
+
# # ActiveJob::Base.queue_adapter.filter = [JobClass]
|
267
|
+
# #
|
268
|
+
# config.before(:example, :perform_enqueued) do |example|
|
269
|
+
# ActiveJob::Base.queue_adapter.filter =
|
270
|
+
# example.metadata[:perform_enqueued].try(:to_a)
|
271
|
+
#
|
272
|
+
# ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
|
273
|
+
# ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = true
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# config.after(:example, :perform_enqueued) do
|
277
|
+
# ActiveJob::Base.queue_adapter.filter = nil
|
278
|
+
# ActiveJob::Base.queue_adapter.enqueued_jobs = []
|
279
|
+
# ActiveJob::Base.queue_adapter.performed_jobs = []
|
280
|
+
#
|
281
|
+
# ActiveJob::Base.queue_adapter.perform_enqueued_jobs = false
|
282
|
+
# ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = false
|
283
|
+
# end
|
data/tasks/qa_server_dev.rake
CHANGED