How to supply parameters to integration tests?

Lets assume you have a library crate that talks to external resources like databases. You’ve added enough unit tests to be sure that each unit works as expected. Now you want to test if you library correctly behaves when it talks to the database. For this, you plan is to get a local database that contains test data up and running (e.g. with docker). But how do you get the contact points of the data base (IP-adress or hostname, port, …) to the integration tests? You don’t want to put them in your code…

I’ve read what The Book (2nd ed.) has to say about integration tests. What I’d really like is to pass every additional information my integration tests need as command line parameters.

Of course, environment variables already work, but once your integration testing gets to a certain complexity, it would be nice to have something like command line parameters work too.

So, in general, how do you get information that might not be available at compile time to your integration tests?

In that chapter there’s a description of using a common module for setup tasks. I’d have that module read the parameters from a json/toml/whatever file and return them in a simple struct for tests to use.