generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add test cases for partially delivered submissions #16055
Merged
thetaurean
merged 5 commits into
master
from
platform/thetaurean/15645-partially-delivered
Oct 9, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
446f6d5
Updated submission history test cases
thetaurean b4ceab5
Merge branch 'master' into platform/thetaurean/15645-partially-delivered
thetaurean 2906942
Merge branch 'master' into platform/thetaurean/15645-partially-delivered
thetaurean ecc6d50
Rework theNextAction members
thetaurean dee5da9
Merge branch 'master' into platform/thetaurean/15645-partially-delivered
thetaurean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,128 @@ class SubmissionFunctionIntegrationTests { | |
|
||
@Test | ||
fun `it should return a history for partially delivered submission`() { | ||
val submittedReport = reportGraph { | ||
topic(Topic.FULL_ELR) | ||
format(MimeFormat.HL7) | ||
sender(UniversalPipelineTestUtils.hl7Sender) | ||
|
||
submission { | ||
action(TaskAction.receive) | ||
reportGraphNode { | ||
action(TaskAction.convert) | ||
log(ActionLog(InvalidParamMessage("log"), type = ActionLogLevel.warning)) | ||
reportGraphNode { | ||
action(TaskAction.destination_filter) | ||
reportGraphNode { | ||
action(TaskAction.none) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[1]) | ||
itemCount(0) | ||
} | ||
} | ||
reportGraphNode { | ||
action(TaskAction.destination_filter) | ||
reportGraphNode { | ||
action(TaskAction.receiver_filter) | ||
reportGraphNode { | ||
action(TaskAction.translate) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[0]) | ||
reportGraphNode { | ||
action(TaskAction.send) | ||
transportResult("Success") | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[0]) | ||
} | ||
} | ||
} | ||
reportGraphNode { | ||
action(TaskAction.receiver_filter) | ||
reportGraphNode { | ||
action(TaskAction.none) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[1]) | ||
itemCount(0) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}.generate(ReportStreamTestDatabaseContainer.testDatabaseAccess) | ||
|
||
val httpRequestMessage = MockHttpRequestMessage() | ||
|
||
val func = setupSubmissionFunction() | ||
|
||
val history = func | ||
.getReportDetailedHistory(httpRequestMessage, submittedReport.node.reportId.toString()) | ||
assertThat(history).isNotNull() | ||
val historyNode = JacksonMapperUtilities.defaultMapper.readTree(history.body.toString()) | ||
assertThat( | ||
historyNode.get("overallStatus").asText() | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) | ||
assertThat(historyNode.get("destinations").size()).isEqualTo(2) | ||
assertThat(historyNode.get("errors").size()).isEqualTo(0) | ||
assertThat(historyNode.get("warnings").size()).isEqualTo(1) | ||
} | ||
|
||
// this test remains to prevent breaking queries against old submissions that used the legacy route step | ||
@Test | ||
fun `it should return a history for an partially delivered submission (for legacy route step)`() { | ||
val submittedReport = reportGraph { | ||
topic(Topic.FULL_ELR) | ||
format(MimeFormat.HL7) | ||
sender(UniversalPipelineTestUtils.hl7Sender) | ||
|
||
submission { | ||
action(TaskAction.receive) | ||
reportGraphNode { | ||
action(TaskAction.convert) | ||
log(ActionLog(InvalidParamMessage("log"), type = ActionLogLevel.warning)) | ||
reportGraphNode { | ||
action(TaskAction.route) | ||
reportGraphNode { | ||
action(TaskAction.none) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[1]) | ||
itemCount(0) | ||
} | ||
} | ||
reportGraphNode { | ||
action(TaskAction.route) | ||
reportGraphNode { | ||
action(TaskAction.translate) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[0]) | ||
reportGraphNode { | ||
action(TaskAction.send) | ||
transportResult("Success") | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[0]) | ||
} | ||
} | ||
reportGraphNode { | ||
action(TaskAction.none) | ||
receiver(UniversalPipelineTestUtils.universalPipelineOrganization.receivers[1]) | ||
itemCount(0) | ||
} | ||
} | ||
} | ||
} | ||
}.generate(ReportStreamTestDatabaseContainer.testDatabaseAccess) | ||
|
||
val httpRequestMessage = MockHttpRequestMessage() | ||
|
||
val func = setupSubmissionFunction() | ||
|
||
val history = func | ||
.getReportDetailedHistory(httpRequestMessage, submittedReport.node.reportId.toString()) | ||
assertThat(history).isNotNull() | ||
val historyNode = JacksonMapperUtilities.defaultMapper.readTree(history.body.toString()) | ||
assertThat( | ||
historyNode.get("overallStatus").asText() | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) | ||
assertThat(historyNode.get("destinations").size()).isEqualTo(2) | ||
assertThat(historyNode.get("errors").size()).isEqualTo(0) | ||
assertThat(historyNode.get("warnings").size()).isEqualTo(1) | ||
} | ||
|
||
// TODO: https://github.com/CDCgov/prime-reportstream/issues/16054 | ||
@Test | ||
fun `it should return a history for an in-flight submission`() { | ||
val submittedReport = reportGraph { | ||
topic(Topic.FULL_ELR) | ||
format(MimeFormat.HL7) | ||
|
@@ -126,15 +248,16 @@ class SubmissionFunctionIntegrationTests { | |
val historyNode = JacksonMapperUtilities.defaultMapper.readTree(history.body.toString()) | ||
assertThat( | ||
historyNode.get("overallStatus").asText() | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) // TODO: should be RECEIVED | ||
assertThat(historyNode.get("destinations").size()).isEqualTo(2) | ||
assertThat(historyNode.get("errors").size()).isEqualTo(0) | ||
assertThat(historyNode.get("warnings").size()).isEqualTo(1) | ||
} | ||
|
||
// TODO: https://github.com/CDCgov/prime-reportstream/issues/16054 | ||
// this test remains to prevent breaking queries against old submissions that used the legacy route step | ||
@Test | ||
fun `it should return a history for partially delivered submission (for legacy route step)`() { | ||
fun `it should return a history for an in-flight submission (for legacy route step)`() { | ||
val submittedReport = reportGraph { | ||
topic(Topic.FULL_ELR) | ||
format(MimeFormat.HL7) | ||
|
@@ -184,7 +307,7 @@ class SubmissionFunctionIntegrationTests { | |
val historyNode = JacksonMapperUtilities.defaultMapper.readTree(history.body.toString()) | ||
assertThat( | ||
historyNode.get("overallStatus").asText() | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) | ||
).isEqualTo(DetailedSubmissionHistory.Status.PARTIALLY_DELIVERED.toString()) // TODO: should be RECEIVED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the TODO? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to the todo in the function header (#16054) |
||
assertThat(historyNode.get("destinations").size()).isEqualTo(2) | ||
assertThat(historyNode.get("errors").size()).isEqualTo(0) | ||
assertThat(historyNode.get("warnings").size()).isEqualTo(1) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the todo in the function header (#16054)