erikengervall/dockest

helper utilities for accessing service environment variables

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
It would be nice to have a helper function for retrieving an environment variable value from a service configuration. E.g. Inside your test you want to enqueue something to a redis queue whose name is set through a container environment variable.

Describe the solution you'd like
Add a helper function to the docker/test-helper.

// throws in case `serviceName` or `environmentVariableName` does not exist.
type ResolveServiceEnvironmentVariableValue = (
  serviceName: string,
  environmentVariableName: string
) => string

Describe alternatives you've considered

  • Hardcoding the environment variables inside your tests.
  • Load the docker-compose.yml file inside the test file