This pushed me to try out a command i.e mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:6.1.0-SNAPSHOT:setup -DserverId=serve88 -Ddistro=referenceapplication:2.13.0 -DbatchAnswers="8080,1044,MySQL 5.6,jdbc:mygjfsql://localhost:3306/@DBNAME@" that has batch answers and wrong db connections (wrong db uri in this case) which goes ahead and creates the server regardless of whether the db connects or not. It is at the point of running the server that the server fails to connect to the database. I think this needs to fail so do you think this is something that i need to ticket or its the original thought and shouldn’t be tampered with?!
@mherman22 - possibly, though I would say that using a command like you have above with batch answers is more of an advanced feature and potentially less in need of this level of validation, which is really most important for the interactive use case and less advanced users. The batch commands like you include here are most commonly going to be used in a non-interactive scenario - like in a CI process - and there may be practical reasons why no database is available at the time this command runs but you still want it to proceed without failure. It isn’t actually important if a database is available for connection at the time of SDK setup, it’s only important at the time of SDK run, so we may not want to force this constraint in all situations. Interested to hear what others think though. We could of course keep things consistent, and then add a flag to control whether DB validation should happen or not, if we feel this is important.
It probably makes more sense to make the whole “attempt to connect to database” into it’s own parameter. We can default it to false if, e.g., the CI environment variable is set to "true" (this is a standard practice for much CI software). Otherwise, I think what Herman is pointing out is we lose the ability to properly test the interactive flow because we have this case where batchAnswers is doing more than just storing a sequence of responses to interactive prompts.
It’s much harder to fake out interactive entry in an integration test than it is to require users to use a special parameter when they don’t need the SDK to validate the database connection.