Skip to content

Commit

Permalink
update for inferno_core 0.0.5 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammjammjamm authored Aug 17, 2021
1 parent c058e71 commit 22108c9
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 89 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
JS_HOST=""
VALIDATOR_URL=http://validator_service/validatorapi
VALIDATOR_URL=http://validator_service:4567
REDIS_URL=redis://redis:6379/0
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VALIDATOR_URL=https://example.com/validatorapi
ASYNC_JOBS=false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/data/*.db
/data/redis/*.rdb
/data/redis/*.aof
/tmp
.env.local
.env.*.local
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ADD lib/ips/version.rb $INSTALL_PATH/lib/ips/version.rb
ADD *.gemspec $INSTALL_PATH
ADD Gemfile* $INSTALL_PATH
RUN gem install bundler
RUN bundle config set --local deployment 'true'
RUN bundle install

ADD . $INSTALL_PATH
Expand Down
62 changes: 38 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
PATH
remote: .
specs:
ips_test_kit (0.0.1)
inferno_core (>= 0.0.3)
ips_test_kit (0.0.2)
inferno_core (= 0.0.5)

GEM
remote: https://rubygems.org/
specs:
activesupport (6.1.3.2)
activesupport (6.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
bcp47 (0.3.3)
i18n
blueprinter (0.25.2)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.9)
connection_pool (2.2.5)
crack (0.4.5)
rexml
database_cleaner (1.99.0)
Expand All @@ -40,10 +41,10 @@ GEM
dry-container (0.8.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.6.0)
dry-core (0.7.1)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-inflector (0.2.1)
dry-logic (1.2.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
Expand All @@ -68,19 +69,25 @@ GEM
dry-logic (~> 1.0, >= 1.0.2)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
faraday (1.4.2)
faraday (1.7.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.1.0)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
fhir_client (4.0.6)
activesupport (>= 3)
addressable (>= 2.3)
Expand All @@ -92,21 +99,21 @@ GEM
rack (>= 1.5)
rest-client (~> 2.0)
tilt (>= 1.1)
fhir_dstu2_models (1.0.11)
fhir_dstu2_models (1.1.0)
bcp47 (>= 0.3)
date_time_precision (>= 0.8)
mime-types (>= 3.0)
nokogiri (>= 1.10.4)
fhir_models (4.1.2)
nokogiri (>= 1.11.4)
fhir_models (4.2.0)
bcp47 (>= 0.3)
date_time_precision (>= 0.8)
mime-types (>= 3.0)
nokogiri (>= 1.10.4)
fhir_stu3_models (3.0.2)
nokogiri (>= 1.11.4)
fhir_stu3_models (3.1.0)
bcp47 (>= 0.3)
date_time_precision (>= 0.8)
mime-types (>= 3.0)
nokogiri (>= 1.10.4)
nokogiri (>= 1.11.4)
hanami-controller (1.3.3)
hanami-utils (~> 1.3)
rack (~> 2.0)
Expand All @@ -127,13 +134,14 @@ GEM
i18n (1.8.10)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inferno_core (0.0.3)
inferno_core (0.0.5)
activesupport (~> 6.1)
blueprinter (= 0.25.2)
dotenv (~> 2.7)
dry-system (= 0.18.1)
faraday (~> 1.2)
fhir_client (~> 4.0)
fhir_models (~> 4.2.0)
hanami-controller (~> 1.3)
hanami-router (~> 1.3)
oj (~> 3.11)
Expand All @@ -142,41 +150,43 @@ GEM
puma (~> 5.3)
rake (~> 13.0)
sequel (~> 5.42)
sidekiq (~> 6.2.1)
sqlite3 (~> 1.4)
jwt (2.2.3)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mime-types-data (3.2021.0704)
minitest (5.14.4)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
netrc (0.11.0)
nio4r (2.5.7)
nokogiri (1.11.7-x86_64-darwin)
nio4r (2.5.8)
nokogiri (1.12.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.11.7-x86_64-linux)
nokogiri (1.12.2-x86_64-linux)
racc (~> 1.4)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
oj (3.11.6)
oj (3.13.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.8.0)
byebug (~> 11.0)
pry (~> 0.10)
public_suffix (4.0.6)
puma (5.3.2)
puma (5.4.0)
nio4r (~> 2.0)
racc (1.5.2)
rack (2.2.3)
rake (13.0.3)
rake (13.0.6)
redis (4.4.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
Expand All @@ -196,8 +206,12 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
ruby2_keywords (0.0.4)
sequel (5.45.0)
ruby2_keywords (0.0.5)
sequel (5.47.0)
sidekiq (6.2.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
sqlite3 (1.4.2)
tilt (2.0.10)
transproc (1.1.1)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ these tests so that you don't have to configure ruby locally.
- Clone this repo.
- Run `docker-compose build` in this repo.
- Run `docker-compose pull` in this repo.
- Run `docker-compose run inferno bundle exec rake db:migrate` to set up the
database.
- Run `docker-compose up` in this repo.
- Navigate to `http://localhost:4567`. The IPS test suite will be available.
9 changes: 9 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ begin
task default: :spec
rescue LoadError # rubocop:disable Lint/SuppressedException
end

namespace :db do
desc 'Apply changes to the database'
task :migrate do
require 'inferno'

Inferno::Application.start(:db)
end
end
Empty file added data/redis/.keep
Empty file.
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ services:
image: infernocommunity/fhir-validator-service
volumes:
- ./lib/ips/igs:/home/igs
redis:
image: redis
volumes:
- ./data/redis:/data
command: redis-server --appendonly yes
worker:
build:
context: ./
volumes:
- ./data:/opt/inferno/data
command: bundle exec sidekiq -r ./worker.rb
depends_on:
- redis
4 changes: 2 additions & 2 deletions ips_test_kit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Gem::Specification.new do |spec|
spec.summary = 'A collection of tests for the International Patient Summary FHIR Implementation Guide'
spec.description = 'A collection of tests for the International Patient Summary FHIR Implementation Guide'
spec.homepage = 'https://github.com/inferno_community/ips-test-kit'
spec.license = 'Apache 2.0'
spec.add_runtime_dependency 'inferno_core', '>= 0.0.3'
spec.license = 'Apache-2.0'
spec.add_runtime_dependency 'inferno_core', '0.0.5'
spec.add_development_dependency 'database_cleaner-sequel', '~> 1.8'
spec.add_development_dependency 'factory_bot', '~> 6.1'
spec.add_development_dependency 'rspec', '~> 3.10'
Expand Down
2 changes: 1 addition & 1 deletion lib/ips/document_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DocumentOperation < Inferno::TestGroup

composition = resource
references_in_composition = []
walk_resource(composition) do |value, meta, _path|
composition.each_element do |value, meta, _path|
next if meta['type'] != 'Reference'
next if value.reference.blank?

Expand Down
2 changes: 1 addition & 1 deletion lib/ips/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module IPS
VERSION = '0.0.1'.freeze
VERSION = '0.0.2'.freeze
end
19 changes: 11 additions & 8 deletions spec/ips/condition_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
RSpec.describe IPS::Condition do
let(:suite) { Inferno::Repositories::TestSuites.new.find('ips') }
let(:group) { suite.groups[1].groups[21] }
let(:session_data_repo) { Inferno::Repositories::SessionData.new }
let(:test_session) { repo_create(:test_session, test_suite_id: 'ips') }
let(:url) { 'http://example.com/fhir' }
let(:error_outcome) { FHIR::OperationOutcome.new(issue: [{ severity: 'error' }]) }

def run(runnable, inputs = {})
test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash)
test_run = Inferno::Repositories::TestRuns.new.create(test_run_params)
Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable, inputs)
Inferno::Repositories::TestRuns.new.results_for_test_run(test_run.id)
inputs.each do |name, value|
session_data_repo.save(test_session_id: test_session.id, name: name, value: value)
end
Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable)
end

describe 'read test' do
Expand All @@ -21,7 +24,7 @@ def run(runnable, inputs = {})
stub_request(:get, "#{url}/Condition/#{condition_id}")
.to_return(status: 200, body: resource.to_json)

result = run(test, url: url, condition_id: condition_id).first
result = run(test, url: url, condition_id: condition_id)

expect(result.result).to eq('pass')
end
Expand All @@ -31,7 +34,7 @@ def run(runnable, inputs = {})
stub_request(:get, "#{url}/Condition/#{condition_id}")
.to_return(status: 201, body: resource.to_json)

result = run(test, url: url, condition_id: condition_id).first
result = run(test, url: url, condition_id: condition_id)

expect(result.result).to eq('fail')
expect(result.result_message).to match(/200/)
Expand All @@ -42,7 +45,7 @@ def run(runnable, inputs = {})
stub_request(:get, "#{url}/Condition/#{condition_id}")
.to_return(status: 200, body: resource.to_json)

result = run(test, url: url, condition_id: condition_id).first
result = run(test, url: url, condition_id: condition_id)

expect(result.result).to eq('fail')
expect(result.result_message).to match(/Condition/)
Expand All @@ -53,7 +56,7 @@ def run(runnable, inputs = {})
stub_request(:get, "#{url}/Condition/#{condition_id}")
.to_return(status: 200, body: resource.to_json)

result = run(test, url: url, condition_id: condition_id).first
result = run(test, url: url, condition_id: condition_id)

expect(result.result).to eq('fail')
expect(result.result_message).to match(/resource with id/)
Expand All @@ -76,7 +79,7 @@ def run(runnable, inputs = {})
response_body: resource.to_json
)

result = run(test).first
result = run(test)

expect(result.result).to eq('pass')
end
Expand All @@ -94,7 +97,7 @@ def run(runnable, inputs = {})
response_body: resource.to_json
)

result = run(test).first
result = run(test)

expect(result.result).to eq('fail')
end
Expand Down
Loading

0 comments on commit 22108c9

Please sign in to comment.