ebi-gene-expression-group / atlas-web-bulk

Bulk Expression Atlas web application
Apache License 2.0
0 stars 1 forks source link

CLI call for creating / updating experiments #129

Closed pcm32 closed 1 year ago

pcm32 commented 2 years ago

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.

pcm32 commented 2 years 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.

alfonsomunozpomer commented 2 years ago

Since the CLI is only delegating tasks to other objects, I think the best thing here is to test a couple of cases:

  1. Verify that the return value is what you expect if no experiment accessions are passed
  2. Check that experimentCrud.createExperiment is called for each experiment accession

The 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.