Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
COMPOSE_PROJECT_NAME=operationcodebackend
REDIS_URL=redis://redis:6379/0
RAILS_ENV=development
#RAILS_ENV=development
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ services:

script:
- make build
- |
while ! psql --host=localhost --username=postgres -c 'SELECT 1'> /dev/null 2>&1; do
echo 'Waiting for postgres...'
sleep 1;
done;
- make test
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then make upgrade; fi

Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
RUN bundle install --system

ADD . $APP_HOME/

CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ db_seed:
.PHONY: test
test: bg
docker-compose run operationcode-psql bash -c "while ! psql --host=operationcode-psql --username=postgres -c 'SELECT 1'; do sleep 5; done;"
docker-compose run ${RAILS_CONTAINER} bash -c 'export RAILS_ENV=test && rake db:test:prepare && rake test'
docker-compose run ${RAILS_CONTAINER} bash -c 'RAILS_ENV=test bin/rails db:environment:set && rake db:test:prepare && RAILS_ENV=test bin/rails db:environment:set && rake test'

.PHONY: bundle
bundle:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ version: '2'
services:
web:
build: .
command: bundle exec puma -C config/puma.rb
entrypoint: ["lib/docker-entrypoint.sh"]
command: ["bundle", "exec", "puma", "-C", "config/puma.rb"]
volumes:
- .:/app
volumes_from:
Expand Down Expand Up @@ -41,4 +42,3 @@ services:
- redis
env_file:
- .env

7 changes: 7 additions & 0 deletions lib/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

bundle exec rake db:migrate || bundle exec rake db:setup

exec bundle exec "$@"
12 changes: 12 additions & 0 deletions test/lib/verify_db_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'test_helper'

class VerifyDbTest < ActiveSupport::TestCase

test 'verify test database' do
#Check that the correct database used for testing
query = "SELECT * FROM ar_internal_metadata"
sql = ActiveRecord::Base.connection.execute(query).first
assert_equal("test", sql["value"] )
end

end