diff --git a/.env b/.env index 05b2dd3ec..6fed38a7f 100644 --- a/.env +++ b/.env @@ -1,7 +1,6 @@ # URL for FHIR validator service VALIDATOR_URL=http://localhost/validatorapi REDIS_URL=redis://localhost:6379/0 -G10_VALIDATOR_URL=http://localhost/validatorapi FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi FHIRPATH_URL=http://localhost/fhirpath diff --git a/CHANGELOG.md b/CHANGELOG.md index d66961e7f..0de89d3b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +## 0.5.0 +* FI-3358: Check for Duplicate Ids in In-Memory Repositories by @vanessuniq in https://github.com/inferno-framework/inferno-core/pull/551 +* FI-3223: Ensure Request Entity Verb Is Always Downcased by @vanessuniq in https://github.com/inferno-framework/inferno-core/pull/554 +## 0.4.44 +* FI-2937 inferno execute by @Shaumik-Ashraf in https://github.com/inferno-framework/inferno-core/pull/517 +* FI-3104: Update React + other packages by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/529 +* FI-3188: Update documentation on cli_context options. by @arscan in https://github.com/inferno-framework/inferno-core/pull/535 +* cli git ignore .gem by @rpassas in https://github.com/inferno-framework/inferno-core/pull/534 +* FI-3076: Add FHIRPath Service to Template by @vanessuniq in https://github.com/inferno-framework/inferno-core/pull/532 +* FI-3275 debug: inferno execute input validation by @Shaumik-Ashraf in https://github.com/inferno-framework/inferno-core/pull/542 +* FI-3193 Add instruction to build Ruby Docs by @mrnosal in https://github.com/inferno-framework/inferno-core/pull/536 +* FI-2609 : DSL Link Methods by @vanessuniq in https://github.com/inferno-framework/inferno-core/pull/521 +* FI-3276: Fix AuthInfo Code Documentation by @vanessuniq in https://github.com/inferno-framework/inferno-core/pull/543 +* FI-3286: Rename Auth Type dropdown input by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/545 +* FI-2685: Allow locking individual checkboxes by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/522 +* FI-3216: Update Ruby dependencies by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/538 +* FI-3285: Add fields to backend services access mode by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/544 +* FI-3241: Verify runnable id length by @Jammjammjamm in https://github.com/inferno-framework/inferno-core/pull/547 +* FI-3182 Inferno execute unified short ids option by @Shaumik-Ashraf in https://github.com/inferno-framework/inferno-core/pull/540 +* FI-3318: Fix erroneous submit disabling for checkbox inputs by @AlyssaWang in https://github.com/inferno-framework/inferno-core/pull/548 +* FI-3367 Patch execute rollup by @Shaumik-Ashraf in https://github.com/inferno-framework/inferno-core/pull/550 + ## 0.4.43 * patch undefined method for nil on validator 500 response by @Shaumik-Ashraf in https://github.com/inferno-framework/inferno-core/pull/530 * FI-3172: Fix validator sessions by @Jammjammjamm in https://github.com/inferno-framework/inferno-core/pull/531 @@ -352,15 +374,15 @@ Aligning changes with published gem - the previously published gem does not incl # 0.3.4 -* Incorporate UI changes to improve info, warning, and error test message readability. -* Update to support running locally on M1 MacBooks. -* Update gem dependencies. -* Add deployment documentation - SSRF protection and SSL, database, and path +* Incorporate UI changes to improve info, warning, and error test message readability. +* Update to support running locally on M1 MacBooks. +* Update gem dependencies. +* Add deployment documentation - SSRF protection and SSL, database, and path configuration. * Include links to Inferno's github repository and issues page in testing view. * Improve frontend storage. -* Implement backend support for suite options: this allows test writers to specify which - tests in a suite are executed and which validator to use during execution. +* Implement backend support for suite options: this allows test writers to specify which + tests in a suite are executed and which validator to use during execution. * Add touchscreen support. # 0.3.3 diff --git a/Gemfile.lock b/Gemfile.lock index 3cb12e30c..db440b0df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - inferno_core (0.4.43) + inferno_core (0.5.0) activesupport (~> 6.1.7.5) base62-rb (= 0.3.1) blueprinter (= 0.25.2) diff --git a/lib/inferno/entities/request.rb b/lib/inferno/entities/request.rb index 60409d16f..c79155bb9 100644 --- a/lib/inferno/entities/request.rb +++ b/lib/inferno/entities/request.rb @@ -181,7 +181,7 @@ def from_http_response(response, test_session_id:, direction: 'outgoing', name: .map { |header_name, value| Header.new(name: header_name.downcase, value:, type: 'response') } new( - verb: response.env.method, + verb: response.env.method.downcase, url: response.env.url.to_s, direction:, name:, @@ -210,7 +210,7 @@ def from_fhir_client_reply(reply, test_session_id:, direction: 'outgoing', name: end new( - verb: request[:method], + verb: request[:method].downcase, url: request[:url], direction:, name:, diff --git a/lib/inferno/exceptions.rb b/lib/inferno/exceptions.rb index be2cf498d..bd56d09b6 100644 --- a/lib/inferno/exceptions.rb +++ b/lib/inferno/exceptions.rb @@ -119,5 +119,11 @@ def initialize(id) super("ID '#{id}' exceeds the maximum id length of 255 characters") end end + + class DuplicateEntityIdException < StandardError + def initialize(id) + super("ID '#{id}' already exists. Ensure the uniqueness of the IDs.") + end + end end end diff --git a/lib/inferno/repositories/in_memory_repository.rb b/lib/inferno/repositories/in_memory_repository.rb index b6afdc3ad..8c5e72441 100644 --- a/lib/inferno/repositories/in_memory_repository.rb +++ b/lib/inferno/repositories/in_memory_repository.rb @@ -1,4 +1,5 @@ require 'forwardable' +require_relative '../exceptions' module Inferno module Repositories @@ -8,7 +9,10 @@ class InMemoryRepository def_delegators 'self.class', :all, :all_by_id def insert(entity) + raise Exceptions::DuplicateEntityIdException, entity.id if exists?(entity.id) + all << entity + all_by_id[entity.id.to_s] = entity entity end @@ -17,7 +21,7 @@ def find(id) end def exists?(id) - all_by_id.include? id + all_by_id.key?(id.to_s) end class << self @@ -28,13 +32,6 @@ def all # @private def all_by_id @all_by_id ||= {} - @all_by_id.length == all.length ? @all_by_id : index_by_id - end - - def index_by_id - @all_by_id = {} - all.each { |klass| @all_by_id[klass.id] = klass } - @all_by_id end end end diff --git a/lib/inferno/version.rb b/lib/inferno/version.rb index e9470c5e1..d6fcbe3bc 100644 --- a/lib/inferno/version.rb +++ b/lib/inferno/version.rb @@ -1,4 +1,4 @@ module Inferno # Standard patterns for gem versions: https://guides.rubygems.org/patterns/ - VERSION = '0.4.43'.freeze + VERSION = '0.5.0'.freeze end diff --git a/spec/inferno/entities/test_suite_spec.rb b/spec/inferno/entities/test_suite_spec.rb index a7fe5948c..56c138a71 100644 --- a/spec/inferno/entities/test_suite_spec.rb +++ b/spec/inferno/entities/test_suite_spec.rb @@ -7,6 +7,7 @@ let(:id) { 'GROUP_ID' } before do + suite_class.id(SecureRandom.uuid) allow(Class).to receive(:new).with(Inferno::Entities::TestGroup).and_return(group_class) end diff --git a/spec/inferno/repositories/presets_spec.rb b/spec/inferno/repositories/presets_spec.rb index 97d3c3b4a..6dd65e1f3 100644 --- a/spec/inferno/repositories/presets_spec.rb +++ b/spec/inferno/repositories/presets_spec.rb @@ -13,7 +13,7 @@ File.realpath(File.join(Dir.pwd, 'spec/fixtures/simple_preset.json.erb')) end - let(:uuid) { 'very-random-uuid' } + let(:uuid) { SecureRandom.uuid } before { allow(SecureRandom).to receive(:uuid).and_return(uuid) } diff --git a/spec/inferno/repositories/test_suites_spec.rb b/spec/inferno/repositories/test_suites_spec.rb index 9d91d7ad6..325013698 100644 --- a/spec/inferno/repositories/test_suites_spec.rb +++ b/spec/inferno/repositories/test_suites_spec.rb @@ -24,4 +24,18 @@ expect(record).to be_nil end end + + describe '#insert' do + it 'inserts a new suite into the repository' do + records = repo.all + new_suite = Class.new(Inferno::TestSuite) + new_suite.id('suite_id') + expect { repo.insert(new_suite) }.to change { records.size }.by(1) + expect(records).to include(new_suite) + end + + it 'raises an error if the id already exist' do + expect { repo.insert(suite) }.to raise_error(Inferno::Exceptions::DuplicateEntityIdException, /already exists/) + end + end end diff --git a/spec/inferno/web/serializers/test_group_spec.rb b/spec/inferno/web/serializers/test_group_spec.rb index a71e490f7..9d574b4d3 100644 --- a/spec/inferno/web/serializers/test_group_spec.rb +++ b/spec/inferno/web/serializers/test_group_spec.rb @@ -2,10 +2,10 @@ RSpec.describe Inferno::Web::Serializers::TestGroup do let(:group) { InfrastructureTest::SerializerGroup } - let(:test) { group.tests.first } before do options_multi_group = Class.new(OptionsSuite::AllVersionsGroup) do + id SecureRandom.uuid group from: :v1_group, required_suite_options: { ig_version: '1' }