Skip to content

Commit

Permalink
Merge pull request #72 from CraigCottingham/master
Browse files Browse the repository at this point in the history
Fix test configuration
  • Loading branch information
krisalyssa authored Aug 1, 2019
2 parents e5f1af9 + e3c4863 commit ec648ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
steps:
- checkout

# specify any bash command here prefixed with `run: `
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix deps.get
- run: mix test
- run: DATABASE_URL="postgres://postgres@localhost:5432/kerbal_maps_test" mix test
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ FULL_DOCKER_TAG := finitemonkeys/$(DOCKER_TAG)
DATABASE_USER := postgres
DATABASE_PASSWORD := development
DATABASE_URL := postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@localhost:5432/kerbal_maps
DATABASE_URL_TEST := postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@localhost:5432/kerbal_maps_test

db_create:
docker run --name=postgres-kerbal-maps -p 5432:5432 -e POSTGRES_USER=$(DATABASE_USER) -e POSTGRES_PASSWORD=$(DATABASE_PASSWORD) -d postgres:10.9-alpine
Expand All @@ -30,6 +31,9 @@ develop:
TILE_CDN_URL=https://d3kmnwgldcmvsd.cloudfront.net/tiles \
mix phx.server

test:
DATABASE_URL=$(DATABASE_URL_TEST) mix test

build: buildinfo_file version_file
docker build -t $(DOCKER_TAG) -t $(DOCKER_TAG_LATEST) -t $(FULL_DOCKER_TAG) .

Expand Down
9 changes: 4 additions & 5 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ config :kerbal_maps, KerbalMapsWeb.Endpoint,
]
]

config :kerbal_maps, KerbalMaps.Repo,
url: System.get_env("DATABASE_URL"),
pool_size: 10

config :logger, :console, format: "[$level] $message\n"

config :phoenix, :stacktrace_depth, 20

config :phoenix, :plug_init_mode, :runtime

# Configure your database
config :kerbal_maps, KerbalMaps.Repo,
url: System.get_env("DATABASE_URL"),
pool_size: 10
8 changes: 1 addition & 7 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@ config :kerbal_maps, KerbalMapsWeb.Endpoint,
http: [port: 4002],
server: false

# Print only warnings and errors during test
config :logger, level: :warn

# Configure your database
config :kerbal_maps, KerbalMaps.Repo,
hostname: "127.0.0.1",
port: "5432",
username: "postgres",
password: "",
database: "kerbal_maps_test",
url: System.get_env("DATABASE_URL"),
pool: Ecto.Adapters.SQL.Sandbox

0 comments on commit ec648ac

Please sign in to comment.