Apologies for the basic question, I’m pretty new to Drone.
Regarding the services section, I understand we can start a container running a DB (MySQL, PostgreSQL) as part of the build process.
How does Drone perform the following:
Ensure my test can connect to the database container hostname --> If the hostname is set to ‘database’, do I need to write my test to connect to this specific hostname ?
Load the database schema with some sample data --> Do I need to pass additional arguments to the services section so the database is loaded correctly with some data to test ?
Yes exactly. The below example demonstrates connecting to the service using the container name as the hostname. In terms of your unit tests, I recommend the best practice of reading the database address from environment variable, instead of hard-coding. This will make your tests more portable, and make it easier to run them on Drone
If you are loading your database schema from a file in your repository, you can typically create a pipeline step that is responsible for this task. For example: