From 66ac200733455e5d503a8c01818b523f350e6257 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Wed, 7 Jun 2017 15:26:19 +0200 Subject: [PATCH] Ability to run tests in docker docker-compose -f test/docker-compose.yml run --rm web --- config/test.exs | 1 + test/.env | 4 ++++ test/docker-compose.yml | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 test/.env create mode 100644 test/docker-compose.yml diff --git a/config/test.exs b/config/test.exs index 6acf29c..09ce1ab 100644 --- a/config/test.exs +++ b/config/test.exs @@ -12,6 +12,7 @@ config :logger, level: :warn # Configure your database config :asciinema, Asciinema.Repo, adapter: Ecto.Adapters.Postgres, + url: System.get_env("DATABASE_URL"), username: "postgres", password: "postgres", database: "asciinema_test", diff --git a/test/.env b/test/.env new file mode 100644 index 0000000..fdbdb8f0 --- /dev/null +++ b/test/.env @@ -0,0 +1,4 @@ +RAILS_ENV=test +MIX_ENV=test +BASE_URL=http://localhost:3000 +BUNDLE_PATH=/bundle \ No newline at end of file diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 0000000..8893477 --- /dev/null +++ b/test/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3' + +volumes: + deps: + bundle: + node_modules: + build: + +services: + postgres: + image: postgres + + redis: + image: redis + + web: + build: . + image: asciinema/asciinema.org + command: mix test + links: + - redis + - postgres + env_file: .env + volumes: + - deps:/app/deps:cached + - bundle:/bundle:cached + - node_modules:/app/node_modules:cached + - build:/app/_build:cached + - ../:/app:cached