Closed pcm32 closed 1 year ago
I usually test this as parts of index-gxa or similar repos' tests. However, maybe the first place to test these calls is here really, given that the integration tests are lifting a complete environment. Could you please advice on where would you put such tests here? I guess that SpringBoot / picocli that we are using must have standard ways of testing these cli apps.
Since the CLI is only delegating tasks to other objects, I think the best thing here is to test a couple of cases:
experimentCrud.createExperiment
is called for each experiment accessionThe latter can be done with a Mockito spy. See the integrations tests for GxaExperimentCrud
for an example.
I suggest you mock GxaExperimentCrud
to just do a no-op on success or throw an exception for a specific experiment so you can also test that failures are recorder in failedAccessions
. This, however, might a bit more tricky because it’s a method from a superclass and it can’t be mocked (a spy would be better?). I guess I’d use a temporary file to build the CLI.
Let me know if anything above is unclear.
This PR adds the same functionality that we have in the Single Cell CLI, which allows to add new experiments to the database without having to use the tomcat process. This finalises the entanglement between data production processes and the tomcat process, opening the door for better CI/CD for the bulk web application.