-
Notifications
You must be signed in to change notification settings - Fork 0
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
Reliable test data clear down #215
Conversation
https://eaflood.atlassian.net/browse/WATER-3982 Using the existing acceptance tests a common issue we face is that we can’t clear down the existing test data. Because of the solution previously implemented, it only focuses on data flagged as `is_test === true`. The problem is when using this data for test purposes you will often create related data that is not flagged as `is_test`. This leads to errors in the existing clear down process that we then have to create a and run manual SQL delete scripts to deal with. If we’re often having to write SQL delete scripts manually, and these deal with the foreign key constraints that the existing process isn’t handling, it makes sense to us to use them always rather than the existing brittle process.
I've had a word with @Cruikshanks about the test coverage on the schema services. As they are just for deleting test data we've agreed that they are not worth spending time on full unit testing since this would involve significant work in creating the new schemas/data in the test DB. Testing has been added but just at the high level tear-down service and the controller. |
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.
Just some minor changes! I can't wait to give it a spin when done 😁
Co-authored-by: Alan Cruikshanks <[email protected]>
Co-authored-by: Alan Cruikshanks <[email protected]>
Co-authored-by: Alan Cruikshanks <[email protected]>
Co-authored-by: Alan Cruikshanks <[email protected]>
https://eaflood.atlassian.net/browse/WATER-3982 Using the existing acceptance tests a common issue we face is that we can't clear down the existing test data. Because of the solution previously implemented, it only focuses on data flagged as `is_test === true`. The problem is when using this data for test purposes you will often create related data that is not flagged as `is_test`. This leads to errors in the existing clear down process that we then have to create and run manual SQL delete scripts to deal with. On top of that everything is driven through the network calls across the services. We know they haven't been properly isolated as they should have if micro-services was the intent. Knowing that we can improve the performance by just using direct SQL calls to do the tear down. So we added a [Reliable test data clear down](DEFRA/water-abstraction-system#215) endpoint to the **water-abstraction-system** app. This change updates the acceptance tests to use it rather than the old mechanism. Timings will vary across machines and environments. But so far our tests all show the new endpoint is quicker leading to a reduced runtime for all tests.
https://eaflood.atlassian.net/browse/WATER-3982 Using the existing acceptance tests a common issue we face is that we can't clear down the existing test data. Because of the solution previously implemented, it only focuses on data flagged as `is_test === true`. The problem is when using this data for test purposes you will often create related data that is not flagged as `is_test`. This leads to errors in the existing clear-down process that we then have to create and run manual SQL delete scripts to deal with. On top of that everything is driven through the network calls across the services. We know they haven't been properly isolated as they should have if micro-services was the intent. Knowing that we can improve the performance by just using direct SQL calls to do the teardown. So we added a [Reliable test data clear down](DEFRA/water-abstraction-system#215) endpoint to the **water-abstraction-system** app. This change updates the acceptance tests to use it rather than the old mechanism. Timings will vary across machines and environments. But so far our tests all show the new endpoint is quicker leading to a reduced runtime for all tests.
https://eaflood.atlassian.net/browse/WATER-3982
Using the existing acceptance tests a common issue we face is that we can’t clear down the existing test data. Because of the solution previously implemented, it only focuses on data flagged as
is_test === true
. The problem is when using this data for test purposes you will often create related data that is not flagged asis_test
. This leads to errors in the existing clear down process that we then have to create a and run manual SQL delete scripts to deal with.If we’re often having to write SQL delete scripts manually, and these deal with the foreign key constraints that the existing process isn’t handling, it makes sense to us to use them always rather than the existing brittle process.
This PR creates an endpoint at
/data/tear-down
. To run locally, send aPOST
request tohttp://localhost:8013/data/tear-down
.