-
Notifications
You must be signed in to change notification settings - Fork 2
Rwa 4067 refactor integration tests #1392
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
base: master
Are you sure you want to change the base?
Conversation
|
||
private static SearchTaskRequest invalidCaseId() { | ||
return new SearchTaskRequest(List.of( | ||
new SearchParameterList(CASE_ID, SearchOperator.IN, asList("000000", "", null)) |
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.
If there is null here we are getting "SQLGrammarException: could not extract ResultSet: operator does not exist: text = bytea".
But post springboot upgrade we are not getting that exception.
If this PR is merged before Springboot upgrade, I will add null's in springboot PR.
If springboot PR is merged before this PR, I will put the null's back here.
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.
Need add a ticket to review search request validations.
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.
|
||
private static SearchTaskRequest invalidUserId() { | ||
return new SearchTaskRequest(List.of( | ||
new SearchParameterList(USER, SearchOperator.IN, asList("unknown", "", null)) |
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.
same as above.
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.
Need add a ticket to review search request validations.
accessControlResponse | ||
)) | ||
.hasNoCause() | ||
.hasMessage("Offset index must not be less than zero"); |
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.
In the Hibernate criteria's there's a method call to validate the pagination values.
This is the method "Pageable page = OffsetPageableRequest.of(firstResult, maxResults);"
But in the gin index approach we do not have such validations. So instead of looking for a message I was asserting the Exception directly.
Please suggest if anything needs to be changed.
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.
Need add a ticket to review search request validations.
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.
searchRequest, | ||
accessControlResponse | ||
)) | ||
.hasNoCause() |
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.
Same as above.
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.
Need add a ticket to review search request validations.
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.
.roleAssignments(pagination(Classification.RESTRICTED)) | ||
.searchTaskRequest(searchTaskRequest) | ||
.expectedAmountOfTasksInResponse(20) | ||
.expectedTotalRecords(29) |
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.
Since the gin index approach we don't retrieve any other states except ASSIGNED and UNASSIGNED, I had to correct the expectation count here.
final TaskQueryScenario allTasks = TaskQueryScenario.builder() | ||
.scenarioName("Search by state") | ||
final TaskQueryScenario pendingAssignEmptyTasks = TaskQueryScenario.builder() | ||
.scenarioName("Search by PENDING_AUTO_ASSIGN state, empty results") |
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.
You can probably remove this scenario if you like. It's not an observable state at the moment with the way things work. So I'd be happy with covering just COMPLETED
and CANCELLED
states for negative scenarios.
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.
Removed the case suggested Ravi.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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.
I have had a look through but we probably want Ben's involvement so that tests maintain their value. Can also consider removing any that are not useful any more.
roleAssignment = RoleAssignment.builder().roleName("senior-tribunal-caseworker") | ||
.classification(classification) | ||
.attributes(excludeddAttributes) | ||
.attributes(Collections.emptyMap()) |
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 did you remove the excluded attributes?
cftTaskDatabaseService = new CFTTaskDatabaseService(taskResourceRepository, cftTaskMapper); | ||
} | ||
|
||
@Disabled |
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.
This test still looks like it is Disabled?
final SearchTaskRequest searchTaskRequest = new SearchTaskRequest(List.of( | ||
new SearchParameterList(JURISDICTION, SearchOperator.IN, List.of(WA_JURISDICTION)) | ||
final SearchTaskRequest searchTaskRequest = new SearchTaskRequest( | ||
RequestContext.AVAILABLE_TASKS, |
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.
How come you added this? This will change the nature of the search and apply a set of permissions on it which were not there previously.
.expectedAmountOfTasksInResponse(2) | ||
.expectedTotalRecords(2) | ||
.expectedAmountOfTasksInResponse(0) | ||
.expectedTotalRecords(0) |
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.
Not sure but maybe this test is better served by just removing the state clause or modifying it so ASSIGNED/UNASSIGNED is requested. Seems to lose it's value if it just returns nothing.
.expectedAmountOfTasksInResponse(2) | ||
.expectedTotalRecords(2) | ||
.expectedAmountOfTasksInResponse(1) | ||
.expectedTotalRecords(1) |
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.
Seems like it's worth keeping the result of this test as multiple. Appears to be sending in multiple work_types and then expecting both to hit a record in response? Would be good to modify the data so you have at least one hit per workType.
|
||
INSERT INTO cft_task_db.tasks (task_id, assignee, assignment_expiry, auto_assigned, business_context, case_id, case_name, case_type_id, created, description, due_date_time, has_warnings, jurisdiction, LOCATION, location_name, major_priority, minor_priority, notes, region, region_name, role_category, security_classification, state, task_name, task_system, task_type, termination_reason, title, work_type, execution_type_code, priority_date) | ||
values('8d6cc5cf-c973-11eb-bdba-0242ac111023', 'SELF', '2022-05-09T20:15:45.345875+01:00', FALSE, 'CFT_TASK', '1623278362431023', 'TestCase2', 'Asylum', '2021-05-09T20:15:45.345875+01:00', 'description', '2022-08-09T20:15:45.345875+01:00', FALSE, 'IA', '765324', 'Taylor House', 5000, 0, '[{"user": "userVal", "noteType": "noteTypeVal"}]', '1', 'TestRegion', 'JUDICIAL', 'PUBLIC', 'UNASSIGNED', 'taskName', 'SELF', 'startAppeal', NULL, 'title', 'hearing_work', 'MANUAL', '2022-08-09T20:15:45.345875+01:00'); | ||
values('8d6cc5cf-c973-11eb-bdba-0242ac111023', null, '2022-05-09T20:15:45.345875+01:00', FALSE, 'CFT_TASK', '1623278362431023', 'TestCase2', 'Asylum', '2021-05-09T20:15:45.345875+01:00', 'description', '2022-08-09T20:15:45.345875+01:00', FALSE, 'IA', '765324', 'Taylor House', 5000, 0, '[{"user": "userVal", "noteType": "noteTypeVal"}]', '1', 'TestRegion', 'JUDICIAL', 'PUBLIC', 'UNASSIGNED', 'taskName', 'SELF', 'startAppeal', NULL, 'title', 'hearing_work', 'MANUAL', '2022-08-09T20:15:45.345875+01:00'); |
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.
Any reason for this change in data? SELF
|
||
} | ||
|
||
private void indexRecord() { |
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.
Could we put this in it's own class?
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Before creating a pull request make sure that:
Please remove this line and everything above and fill the following sections:
JIRA link (if applicable)
https://tools.hmcts.net/jira/browse/RWA-4067
Change description
Does this PR introduce a breaking change? (check one with "x")