Skip to content

Commit

Permalink
Merge branch 'main' into scratch-dev-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaumik-Ashraf authored Nov 8, 2024
2 parents 217c9d8 + fa037f1 commit 4d63700
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 21 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -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

Expand Down
34 changes: 28 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/inferno/entities/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:,
Expand Down Expand Up @@ -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:,
Expand Down
6 changes: 6 additions & 0 deletions lib/inferno/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 5 additions & 8 deletions lib/inferno/repositories/in_memory_repository.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'forwardable'
require_relative '../exceptions'

module Inferno
module Repositories
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/inferno/version.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions spec/inferno/entities/test_suite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/inferno/repositories/presets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
14 changes: 14 additions & 0 deletions spec/inferno/repositories/test_suites_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/inferno/web/serializers/test_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down

0 comments on commit 4d63700

Please sign in to comment.