Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-3518/FI-3519: Add basic Bulk Data client test suite, groups, and tests #36

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/bulk_data_test_kit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
require_relative 'inferno_requirements_tools/ext/inferno_core/runnable'
require_relative 'bulk_data_test_kit/v1.0.1/bulk_data_test_suite'
require_relative 'bulk_data_test_kit/v2.0.0/bulk_data_test_suite'
require_relative 'bulk_data_test_kit/v2.0.0_client/bulk_data_client_test_suite'
2 changes: 1 addition & 1 deletion lib/bulk_data_test_kit/v1.0.1/bulk_data_test_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module BulkDataTestKit
module BulkDataV101
class BulkDataTestSuite < Inferno::TestSuite
title 'Bulk Data Access v1.0.1'
title 'Bulk Data Access v1.0.1 Server'
version VERSION
id :bulk_data_v101
links [
Expand Down
2 changes: 1 addition & 1 deletion lib/bulk_data_test_kit/v2.0.0/bulk_data_test_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module BulkDataTestKit
module BulkDataV200
class BulkDataTestSuite < Inferno::TestSuite
title 'Bulk Data Access v2.0.0'
title 'Bulk Data Access v2.0.0 Server'
version VERSION
id :bulk_data_v200
links [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative 'bulk_data_client_delete_wait_test'
require_relative 'bulk_data_client_kick_off_test'
require_relative 'bulk_data_client_delete_test'

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client Delete Tests
class DeleteGroup < Inferno::TestGroup
title 'Bulk Data Client Delete Tests'

description %(
The Bulk Data Client Delete tests verify the ability of a client to delete
a kicked-off bulk data export request.
)

id :bulk_data_client_delete_group

run_as_group

test from: :bulk_data_client_delete_wait
test from: :bulk_data_client_kick_off
test from: :bulk_data_client_delete
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client - Delete
class DeleteTest < Inferno::Test
title 'Bulk Data Delete Request'

description %(
This test verifies that after a Bulk Data request has been started, the client can send a
DELETE request to the URL provided in the Content-Location header to
[delete the request](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-delete-request),
as described in the [FHIR Asynchronous Request Pattern](https://www.hl7.org/fhir/R4/async.html).
)

id :bulk_data_client_delete

verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@119'

run do
assert load_tagged_requests(DELETE_TAG).any?, fail_message
end

def fail_message
'Did not receive a delete request.'
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client - Delete Wait
class DeleteWaitTest < Inferno::Test
include URLs

title 'Wait For Request Sequence'

description %(
This test will receive bulk data export requests until the user confirms they are finished.
)

id :bulk_data_client_delete_wait

input :access_token, :export_type, :group_id

run do
wait(
identifier: access_token,
message: %(
Kick-off a **#{export_type}** endpoint type bulk export using the following base URL:

#{kickoff_url}

#{export_type == GROUP_EXPORT_TYPE ? "Ensure the Group ID is set to **#{group_id}**." : ''}

Include the following bearer access token with all requests: **#{access_token}**

Once the export request has been kicked-off,
[delete the export](https://build.fhir.org/ig/HL7/bulk-data/export.html#bulk-data-delete-request).

The entire request sequence will be recorded and used in the subsequent tests to
verify comformity to the
[Bulk Data IG](https://build.fhir.org/ig/HL7/bulk-data/export.html#sequence-overview).

[Click here](#{resume_pass_url}?id=#{access_token}) when finished.
)
)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

require_relative 'bulk_data_client_export_wait_test'
require_relative 'bulk_data_client_kick_off_test'
require_relative 'bulk_data_client_status_test'
require_relative 'bulk_data_client_output_test'

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client Export Tests
class ExportGroup < Inferno::TestGroup
title 'Bulk Data Client Export Tests'

description %(
The Bulk Data Client Export tests verify the ability of a client to:
- Kick-off a new bulk data export request
- Poll the in-progress request for status updates
- Download a completed bulk data export file
)

id :bulk_data_client_export_group

run_as_group

test from: :bulk_data_client_export_wait
test from: :bulk_data_client_kick_off
test from: :bulk_data_client_status
test from: :bulk_data_client_output
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client - Export Wait
class ExportWaitTest < Inferno::Test
include URLs

title 'Wait For Request Sequence'

description %(
This test will receive bulk data export requests until the user confirms they are finished.
)

id :bulk_data_client_export_wait

input :access_token, :export_type, :group_id

run do
wait(
identifier: access_token,
message: %(
Perform a **#{export_type}** endpoint type bulk export kick-off using the following base URL:

#{kickoff_url}

#{export_type == GROUP_EXPORT_TYPE ? "Ensure the Group ID is set to **#{group_id}**." : ''}

Include the following bearer access token with all requests: **#{access_token}**

After the kick-off is made, a subsequent status request (using the URL provided in the response
to the kick-off request) and then a download request (using the URL provided in the response to
the status request) are expected.

The entire request sequence will be recorded and used in the subsequent tests to
verify comformity to the
[Bulk Data IG](https://build.fhir.org/ig/HL7/bulk-data/export.html#sequence-overview).

[Click here](#{resume_pass_url}?id=#{access_token}) when finished.
)
)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client Kick-off
class KickOffTest < Inferno::Test
title 'Bulk Data Kick-off Request'

description %(
This test verifies that a client can
[kick-off a Bulk Data request](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#roles)
using the `$export` operation against the proper endpoint type.
)

id :bulk_data_client_kick_off

verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@17'

input :export_type

run do
case export_type
when PATIENT_EXPORT_TYPE
assert load_tagged_requests(PATIENT_KICKOFF_TAG).any?, patient_fail_message
when GROUP_EXPORT_TYPE
assert load_tagged_requests(GROUP_KICKOFF_TAG).any?, group_fail_message
when SYSTEM_EXPORT_TYPE
assert load_tagged_requests(SYSTEM_KICKOFF_TAG).any?, system_fail_message
end
end

def patient_fail_message
'Did not receive a Patient type kick-off request.'
end

def group_fail_message
'Did not receive a Group type kick-off request.'
end

def system_fail_message
'Did not receive a System type kick-off request.'
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client Output
class OutputTest < Inferno::Test
title 'Bulk Data Output File Request'

description %(
This test verifies that the client, using the URL supplied in the Complete Status response body,
can [download](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-output-file-request)
the generated Bulk Data file.
)

id :bulk_data_client_output

verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@200'

run do
assert load_tagged_requests(OUTPUT_TAG).any?, fail_message
end

def fail_message
'Did not receive a download request.'
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module BulkDataTestKit
module BulkDataV200Client
# Bulk Data Client Status
class StatusTest < Inferno::Test
title 'Bulk Data Status Request'

description %(
This test verifies that after a Bulk Data request has been started, the client can
[poll the status URL](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-status-request)
provided in the Content-Location header, as as described in the
[FHIR Asynchronous Request Pattern](https://www.hl7.org/fhir/R4/async.html).
)

id :bulk_data_client_status

verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@123'

run do
assert load_tagged_requests(STATUS_TAG).any?, fail_message
end

def fail_message
'Did not receive a status request.'
end
end
end
end
Loading
Loading