.circleci/config.yml
version: 2
jobs:
build:
docker:
- image: circleci/elixir:1.8
environment:
MIX_ENV: test
- image: circleci/postgres:11
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: beaver_test
steps:
- checkout
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mkdir -p test-results/ex_unit
- restore_cache:
keys:
- v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
- v1-mix-cache-{{ .Branch }}-
- v1-mix-cache-
- restore_cache:
keys:
- v1-build-cache-{{ .Branch }}
- v1-build-cache-
- run: mix do deps.get --only test, compile
- save_cache:
key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
paths: deps
- save_cache:
key: v1-build-cache-{{ .Branch }}
paths: _build
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Run test
command: mix test
- store_test_results:
path: test-results
workflows:
version: 2
workflow:
jobs:
- build
Logs for "Container circleci/postgres:11"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data -l logfile start
waiting for server to start....2019-03-23 18:19:59.523 UTC [201] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-03-23 18:19:59.531 UTC [202] LOG: database system was shut down at 2019-03-23 18:19:59 UTC
2019-03-23 18:19:59.533 UTC [201] LOG: database system is ready to accept connections
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2019-03-23 18:19:59.867 UTC [201] LOG: received fast shutdown request
2019-03-23 18:19:59.867 UTC [201] LOG: aborting any active transactions
waiting for server to shut down....2019-03-23 18:19:59.868 UTC [201] LOG: background worker "logical replication launcher" (PID 208) exited with exit code 1
2019-03-23 18:19:59.868 UTC [203] LOG: shutting down
2019-03-23 18:19:59.872 UTC [201] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2019-03-23 18:19:59.975 UTC [7] LOG: listening on IPv4 address "0.0.0.0", port 5432
2019-03-23 18:19:59.975 UTC [7] LOG: listening on IPv6 address "::", port 5432
2019-03-23 18:19:59.975 UTC [7] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-03-23 18:19:59.982 UTC [323] LOG: database system was shut down at 2019-03-23 18:19:59 UTC
2019-03-23 18:19:59.985 UTC [7] LOG: database system is ready to accept connections
2019-03-23 18:20:02.074 UTC [474] LOG: incomplete startup packet
2019-03-23 18:20:02.584 UTC [579] ERROR: database "beaver_test" already exists
2019-03-23 18:20:02.584 UTC [579] STATEMENT: CREATE DATABASE "beaver_test" ENCODING 'UTF8'
Job was canceled
Logs for "Wait for DB"
#!/bin/bash -eo pipefail
dockerize -wait tcp://localhost:5432 -timeout 1m
2019/03/23 18:20:02 Waiting for: tcp://localhost:5432
2019/03/23 18:20:02 Connected to tcp://localhost:5432
You can see from above log, the database should be running, I cannot see what does “Job was canceled” mean.