Chapter 11: Testing

Hi. I’m trying to run my tests on Linux as indicated by the book. I created my Dockerfile and my docker-compose.yml. Plus I’ve changed my configure.swift file to accept environment variables. But when I run docker-compose up --abort-on-container-exit I get this error. Can someone please help me?

Error:
Test Case ‘AcronymTests.testAcronymsCanBeRetrievedFromAPI’ started at 2019-05-12 02:20:03.010
til-app_1 | Fatal error: ‘try!’ expression unexpectedly raised an error: :warning: PostgreSQL Error: No password is required
til-app_1 | - id: PostgreSQLError.trust

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

@jpr98 can you post your Docker Compose file?

Sure, here you go.

version: ‘3’

services:

til-app:

   depends_on:
   - postgres

   build: .

   environment:
   - DATABASE_HOSTNAME=postgres
   - DATABASE_PORT=5432

postgres:

 image: "postgres"

 environment:
 - POSTGRES_DB=vapor-test
 - POSTGRES_USER=vapor
 - POSTGRES_PASSWORD=password

Cool that looks valid - how about your configure.swift?

I got it working. The only change I made was indenting the list elements (the ones marked with - ).
Thanks for the help!

1 Like