inferno_core 0.0.6 → 0.0.8

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/bin/inferno +7 -0
  3. data/lib/inferno/apps/cli/console.rb +12 -0
  4. data/lib/inferno/apps/cli/main.rb +18 -0
  5. data/lib/inferno/apps/cli/migration.rb +14 -0
  6. data/lib/inferno/apps/cli.rb +8 -0
  7. data/lib/inferno/apps/web/index.html.erb +1 -0
  8. data/lib/inferno/config/application.rb +3 -0
  9. data/lib/inferno/config/boot/db.rb +1 -9
  10. data/lib/inferno/config/boot/logging.rb +2 -0
  11. data/lib/inferno/db/migrations/001_create_initial_structure.rb +1 -1
  12. data/lib/inferno/db/schema.rb +1 -1
  13. data/lib/inferno/dsl/assertions.rb +66 -1
  14. data/lib/inferno/dsl/configurable.rb +1 -1
  15. data/lib/inferno/dsl/fhir_client.rb +22 -18
  16. data/lib/inferno/dsl/fhir_client_builder.rb +3 -3
  17. data/lib/inferno/dsl/fhir_validation.rb +105 -1
  18. data/lib/inferno/dsl/http_client.rb +4 -4
  19. data/lib/inferno/dsl/http_client_builder.rb +3 -3
  20. data/lib/inferno/dsl/request_storage.rb +8 -8
  21. data/lib/inferno/dsl/results.rb +1 -1
  22. data/lib/inferno/dsl/resume_test_route.rb +9 -9
  23. data/lib/inferno/dsl/runnable.rb +36 -18
  24. data/lib/inferno/entities/header.rb +14 -7
  25. data/lib/inferno/entities/message.rb +16 -8
  26. data/lib/inferno/entities/request.rb +32 -19
  27. data/lib/inferno/entities/result.rb +36 -29
  28. data/lib/inferno/entities/session_data.rb +12 -6
  29. data/lib/inferno/entities/test.rb +13 -0
  30. data/lib/inferno/entities/test_run.rb +29 -6
  31. data/lib/inferno/entities/test_session.rb +16 -10
  32. data/lib/inferno/public/217.bundle.js +1 -1
  33. data/lib/inferno/public/bundle.js +154 -1
  34. data/lib/inferno/public/bundle.js.LICENSE.txt +15 -0
  35. data/lib/inferno/repositories/in_memory_repository.rb +1 -1
  36. data/lib/inferno/repositories/results.rb +1 -1
  37. data/lib/inferno/spec_support.rb +1 -1
  38. data/lib/inferno/test_runner.rb +1 -1
  39. data/lib/inferno/utils/markdown_formatter.rb +1 -1
  40. data/lib/inferno/utils/middleware/request_logger.rb +9 -3
  41. data/lib/inferno/utils/migration.rb +17 -0
  42. data/lib/inferno/version.rb +1 -1
  43. data/lib/inferno.rb +0 -4
  44. metadata +41 -8
  45. data/bin/inferno-console +0 -8
@@ -15,12 +15,14 @@ module Inferno
15
15
  attr_accessor :result_message
16
16
  attr_reader :test_session_id, :scratch
17
17
 
18
+ # @private
18
19
  def initialize(**params)
19
20
  params[:inputs]&.each { |key, value| instance_variable_set("@#{key}", value) }
20
21
  @scratch = params[:scratch]
21
22
  @test_session_id = params[:test_session_id]
22
23
  end
23
24
 
25
+ # @private
24
26
  def messages
25
27
  @messages ||= []
26
28
  end
@@ -100,6 +102,7 @@ module Inferno
100
102
  add_message('warning', e.message)
101
103
  end
102
104
 
105
+ # @private
103
106
  def method_missing(name, *args, &block)
104
107
  parent_instance = self.class.parent&.new
105
108
  if parent_instance.respond_to?(name)
@@ -109,6 +112,7 @@ module Inferno
109
112
  end
110
113
  end
111
114
 
115
+ # @private
112
116
  def respond_to_missing?(name, _include_private = false)
113
117
  self.class.parent&.new&.respond_to?(name)
114
118
  end
@@ -155,6 +159,10 @@ module Inferno
155
159
  Inferno::Repositories::Tests.new
156
160
  end
157
161
 
162
+ # Set/Get the block that is executed when a Test is run
163
+ #
164
+ # @param block [Proc]
165
+ # @return [Proc] the block that is executed when a Test is run
158
166
  def block(&block)
159
167
  return @block unless block_given?
160
168
 
@@ -163,6 +171,7 @@ module Inferno
163
171
 
164
172
  alias run block
165
173
 
174
+ # @private
166
175
  def default_id
167
176
  return name if name.present?
168
177
 
@@ -170,16 +179,19 @@ module Inferno
170
179
  "Test#{suffix}"
171
180
  end
172
181
 
182
+ # @private
173
183
  def reference_hash
174
184
  {
175
185
  test_id: id
176
186
  }
177
187
  end
178
188
 
189
+ # @private
179
190
  def test_count
180
191
  1
181
192
  end
182
193
 
194
+ # @private
183
195
  def method_missing(name, *args, &block)
184
196
  parent_instance = parent&.new
185
197
  if parent_instance.respond_to?(name)
@@ -189,6 +201,7 @@ module Inferno
189
201
  end
190
202
  end
191
203
 
204
+ # @private
192
205
  def respond_to_missing?(name, _include_private = false)
193
206
  parent&.new&.respond_to?(name)
194
207
  end
@@ -2,12 +2,35 @@ module Inferno
2
2
  module Entities
3
3
  # A `TestRun` represents a request to execute an executable set of tests.
4
4
  #
5
- # @attr_accessor [String] id of the test input
6
- # @attr_accessor [String] test_session_id
7
- # @attr_accessor [String] status
8
- # @attr_accessor [String] test_suite_id
9
- # @attr_accessor [String] test_group_id
10
- # @attr_accessor [String] test_id
5
+ # @!attribute id
6
+ # @return [String] id of the test run
7
+ # @!attribute created_at
8
+ # @return [Time] creation timestamp
9
+ # @!attribute updated_at
10
+ # @return [Time] update timestamp
11
+ # @!attribute test_session_id
12
+ # @return [String]
13
+ # @!attribute status
14
+ # @return [String]
15
+ # @!attribute test_id
16
+ # @return [String, nil] id of the `Test` this result belongs to
17
+ # @!attribute test
18
+ # @return [Test, nil] the `Test` this result belongs to
19
+ # @!attribute test_group_id
20
+ # @return [String, nil] id of the `TestGroup` this result belongs to
21
+ # @!attribute test_group
22
+ # @return [TestGroup, nil] the `TestGroup` this result belongs to
23
+ # @!attribute test_suite_id
24
+ # @return [String, nil] id of the `TestSuite` this result belongs to
25
+ # @!attribute test_suite
26
+ # @return [TestSuite, nil] the `TestSuite` this result belongs to
27
+ # @!attribute inputs
28
+ # @return [Array<Hash>]
29
+ # @!attribute results
30
+ # @return [Array<Inferno::Entities::Result>]
31
+ # @!attribute identifier
32
+ # @return [String, nil] identfier for a waiting `TestRun`
33
+ # @!attribute wait_timeout
11
34
  class TestRun < Entity
12
35
  STATUS_OPTIONS = ['queued', 'running', 'waiting', 'done'].freeze
13
36
  ATTRIBUTES = [
@@ -2,17 +2,23 @@ module Inferno
2
2
  module Entities
3
3
  # A `TestSession` represents an individual testing session.
4
4
  #
5
- # @attr_accessor [String] id id of the session
6
- # @attr_accessor [Time] created_at creation timestamp
7
- # @attr_accessor [Time] updated_at update timestamp
8
- # @attr_accessor [String] test_suite_id id of the `TestSuite` being run in
9
- # this session
10
- # @attr_accessor [Inferno::Entities::TestSuite] test_suite the `TestSuite` being run in
11
- # this session
12
- # @attr_accessor [Array<Inferno::Entities::TestRun>] test_runs the `TestRuns`
5
+ # @!attribute id
6
+ # @return [String] id of the session
7
+ # @!attribute created_at
8
+ # @return [Time] creation timestamp
9
+ # @!attribute updated_at
10
+ # @return [Time] update timestamp
11
+ # @!attribute test_suite_id
12
+ # @return [String] id of the `TestSuite` being run in this session
13
+ # @!attribute test_suite
14
+ # @return [Inferno::Entities::TestSuite] the `TestSuite` being run in this
15
+ # session
16
+ # @!attribute test_runs
17
+ # @return [Array<Inferno::Entities::TestRun>] the `TestRuns` associated
18
+ # with this session
19
+ # @!attribute results
20
+ # @return [Array<Inferno::Entities::TestResult>] the `TestResults`
13
21
  # associated with this session
14
- # @attr_accessor [Array<Inferno::Entities::TestResult>] results the
15
- # `TestResults` associated with this session
16
22
  class TestSession < Entity
17
23
  ATTRIBUTES = [:id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results].freeze
18
24
 
@@ -1 +1 @@
1
- (self.webpackChunkinferno_web_app=self.webpackChunkinferno_web_app||[]).push([[217],{3217:(t,e,n)=>{"use strict";n.r(e),n.d(e,{getCLS:()=>v,getFCP:()=>g,getFID:()=>h,getLCP:()=>y,getTTFB:()=>F});var i,a,r=function(){return"".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)},o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return{name:t,value:e,delta:0,entries:[],id:r(),isFinal:!1}},s=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},u=!1,c=!1,p=function(t){u=!t.persisted},f=function(){addEventListener("pagehide",p),addEventListener("beforeunload",(function(){}))},l=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c||(f(),c=!0),addEventListener("visibilitychange",(function(e){var n=e.timeStamp;"hidden"===document.visibilityState&&t({timeStamp:n,isUnloading:u})}),{capture:!0,once:e})},d=function(t,e,n,i){var a;return function(){n&&e.isFinal&&n.disconnect(),e.value>=0&&(i||e.isFinal||"hidden"===document.visibilityState)&&(e.delta=e.value-(a||0),(e.delta||e.isFinal||void 0===a)&&(t(e),a=e.value))}},v=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),e())},r=s("layout-shift",a);r&&(e=d(t,i,r,n),l((function(t){var n=t.isUnloading;r.takeRecords().map(a),n&&(i.isFinal=!0),e()})))},m=function(){return void 0===i&&(i="hidden"===document.visibilityState?0:1/0,l((function(t){var e=t.timeStamp;return i=e}),!0)),{get timeStamp(){return i}}},g=function(t){var e,n=o("FCP"),i=m(),a=s("paint",(function(t){"first-contentful-paint"===t.name&&t.startTime<i.timeStamp&&(n.value=t.startTime,n.isFinal=!0,n.entries.push(t),e())}));a&&(e=d(t,n,a))},h=function(t){var e=o("FID"),n=m(),i=function(t){t.startTime<n.timeStamp&&(e.value=t.processingStart-t.startTime,e.entries.push(t),e.isFinal=!0,r())},a=s("first-input",i),r=d(t,e,a);a?l((function(){a.takeRecords().map(i),a.disconnect()}),!0):window.perfMetrics&&window.perfMetrics.onFirstInputDelay&&window.perfMetrics.onFirstInputDelay((function(t,i){i.timeStamp<n.timeStamp&&(e.value=t,e.isFinal=!0,e.entries=[{entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+t}],r())}))},S=function(){return a||(a=new Promise((function(t){return["scroll","keydown","pointerdown"].map((function(e){addEventListener(e,t,{once:!0,passive:!0,capture:!0})}))}))),a},y=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o("LCP"),a=m(),r=function(t){var n=t.startTime;n<a.timeStamp?(i.value=n,i.entries.push(t)):i.isFinal=!0,e()},u=s("largest-contentful-paint",r);if(u){e=d(t,i,u,n);var c=function(){i.isFinal||(u.takeRecords().map(r),i.isFinal=!0,e())};S().then(c),l(c,!0)}},F=function(t){var e,n=o("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();n.value=n.delta=e.responseStart,n.entries=[e],n.isFinal=!0,t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]);
1
+ "use strict";(self.webpackChunkinferno_web_app=self.webpackChunkinferno_web_app||[]).push([[217],{3217:(t,e,n)=>{n.r(e),n.d(e,{getCLS:()=>v,getFCP:()=>g,getFID:()=>h,getLCP:()=>y,getTTFB:()=>F});var i,a,r=function(){return"".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)},o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return{name:t,value:e,delta:0,entries:[],id:r(),isFinal:!1}},s=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},u=!1,c=!1,p=function(t){u=!t.persisted},f=function(){addEventListener("pagehide",p),addEventListener("beforeunload",(function(){}))},l=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];c||(f(),c=!0),addEventListener("visibilitychange",(function(e){var n=e.timeStamp;"hidden"===document.visibilityState&&t({timeStamp:n,isUnloading:u})}),{capture:!0,once:e})},d=function(t,e,n,i){var a;return function(){n&&e.isFinal&&n.disconnect(),e.value>=0&&(i||e.isFinal||"hidden"===document.visibilityState)&&(e.delta=e.value-(a||0),(e.delta||e.isFinal||void 0===a)&&(t(e),a=e.value))}},v=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),e())},r=s("layout-shift",a);r&&(e=d(t,i,r,n),l((function(t){var n=t.isUnloading;r.takeRecords().map(a),n&&(i.isFinal=!0),e()})))},m=function(){return void 0===i&&(i="hidden"===document.visibilityState?0:1/0,l((function(t){var e=t.timeStamp;return i=e}),!0)),{get timeStamp(){return i}}},g=function(t){var e,n=o("FCP"),i=m(),a=s("paint",(function(t){"first-contentful-paint"===t.name&&t.startTime<i.timeStamp&&(n.value=t.startTime,n.isFinal=!0,n.entries.push(t),e())}));a&&(e=d(t,n,a))},h=function(t){var e=o("FID"),n=m(),i=function(t){t.startTime<n.timeStamp&&(e.value=t.processingStart-t.startTime,e.entries.push(t),e.isFinal=!0,r())},a=s("first-input",i),r=d(t,e,a);a?l((function(){a.takeRecords().map(i),a.disconnect()}),!0):window.perfMetrics&&window.perfMetrics.onFirstInputDelay&&window.perfMetrics.onFirstInputDelay((function(t,i){i.timeStamp<n.timeStamp&&(e.value=t,e.isFinal=!0,e.entries=[{entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+t}],r())}))},S=function(){return a||(a=new Promise((function(t){return["scroll","keydown","pointerdown"].map((function(e){addEventListener(e,t,{once:!0,passive:!0,capture:!0})}))}))),a},y=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=o("LCP"),a=m(),r=function(t){var n=t.startTime;n<a.timeStamp?(i.value=n,i.entries.push(t)):i.isFinal=!0,e()},u=s("largest-contentful-paint",r);if(u){e=d(t,i,u,n);var c=function(){i.isFinal||(u.takeRecords().map(r),i.isFinal=!0,e())};S().then(c),l(c,!0)}},F=function(t){var e,n=o("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();n.value=n.delta=e.responseStart,n.entries=[e],n.isFinal=!0,t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]);