Skip to content

Commit

Permalink
Use config.test.rb instead of OVERRIDE_CONFIG, add dip support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Jun 29, 2022
1 parent 92ab245 commit 0356ef8
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby-unit-tests-ag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up solr configsets
run: ./test/solr/generate_ncbo_configsets.sh
- name: create config.rb file
run: cp config/config.rb.sample config/config.rb
run: cp config/config.test.rb config/config.rb
- name: Build docker-compose
run: docker-compose --profile agraph build
- name: Run unit tests
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
- name: Set up solr configsets
run: ./test/solr/generate_ncbo_configsets.sh
- name: create config.rb file
run: cp config/config.rb.sample config/config.rb
run: cp config/config.test.rb config/config.rb
- name: Build docker-compose
run: docker-compose --profile 4store build
- name: Run unit tests
run: docker-compose run ruby wait-for-it solr-ut:8983 -- bundle exec rake test TESTOPTS='-v'

1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ GEM

PLATFORMS
x86_64-darwin-18
x86_64-linux

DEPENDENCIES
activesupport (~> 4)
Expand Down
35 changes: 35 additions & 0 deletions config/config.test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
###
# This file is designed for use in docker based unit testing
#
# All the defaults are set in
# https://github.com/ncbo/ontologies_linked_data/blob/master/lib/ontologies_linked_data/config/config.rb
###

GOO_BACKEND_NAME = ENV.include?("GOO_BACKEND_NAME") ? ENV["GOO_BACKEND_NAME"] : "4store"
GOO_PATH_QUERY = ENV.include?("GOO_PATH_QUERY") ? ENV["GOO_PATH_QUERY"] : "/sparql/"
GOO_PATH_DATA = ENV.include?("GOO_PATH_DATA") ? ENV["GOO_PATH_DATA"] : "/data/"
GOO_PATH_UPDATE = ENV.include?("GOO_PATH_UPDATE") ? ENV["GOO_PATH_UPDATE"] : "/update/"
GOO_PORT = ENV.include?("GOO_PORT") ? ENV["GOO_PORT"] : 9000
GOO_HOST = ENV.include?("GOO_HOST") ? ENV["GOO_HOST"] : "localhost"
REDIS_HOST = ENV.include?("REDIS_HOST") ? ENV["REDIS_HOST"] : "localhost"
REDIS_PORT = ENV.include?("REDIS_PORT") ? ENV["REDIS_PORT"] : 6379
SOLR_TERM_SEARCH_URL = ENV.include?("SOLR_TERM_SEARCH_URL") ? ENV["SOLR_TERM_SEARCH_URL"] : "http://localhost:8983/solr/term_search_core1"
SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8983/solr/prop_search_core1"

LinkedData.config do |config|
config.goo_backend_name = GOO_BACKEND_NAME.to_s
config.goo_host = GOO_HOST.to_s
config.goo_port = GOO_PORT.to_i
config.goo_path_query = GOO_PATH_QUERY.to_s
config.goo_path_data = GOO_PATH_DATA.to_s
config.goo_path_update = GOO_PATH_UPDATE.to_s
config.goo_redis_host = REDIS_HOST.to_s
config.goo_redis_port = REDIS_PORT.to_i
config.http_redis_host = REDIS_HOST.to_s
config.http_redis_port = REDIS_PORT.to_i
config.ontology_analytics_redis_host = REDIS_HOST.to_s
config.ontology_analytics_redis_port = REDIS_PORT.to_i
config.search_server_url = SOLR_TERM_SEARCH_URL.to_s
config.property_search_server_url = SOLR_PROP_SEARCH_URL.to_s
# config.enable_notifications = false
end
56 changes: 56 additions & 0 deletions dip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '7.1'

# Define default environment variables to pass
# to Docker Compose
#environment:
# RAILS_ENV: development

compose:
files:
- .docker-compose.yml
project_name: ontologies_linked_data

interaction:
# This command spins up a ontologies_api container with the required dependencies (solr, 4store, etc),
# and opens a terminal within it.
runner:
description: Open a Bash shell within a ontologies_api container (with dependencies up)
service: ruby
command: /bin/bash

# Run a Rails container without any dependent services (useful for non-Rails scripts)
bash:
description: Run an arbitrary script within a container (or open a shell without deps)
service: ruby
command: /bin/bash
compose_run_options: [ no-deps ]

# A shortcut to run Bundler commands
bundle:
description: Run Bundler commands
service: ruby
command: bundle
compose_run_options: [ no-deps ]

# A shortcut to run unit tests
test:
description: Run minitest unit tests
service: ruby
command: bundle exec rake test

test-ag:
description: Run minitest unit tests
service: ruby-ag
command: bundle exec rake test


'redis-cli':
description: Run Redis console
service: redis-ut
command: redis-cli -h redis-ut

#provision:
#- dip compose down --volumes
#- dip compose up -d solr 4store
#- dip bundle install
#- dip bash -c bin/setup
19 changes: 12 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ x-app: &app
# Increase the version number in the image tag every time Dockerfile or its arguments is changed
image: ontologies_ld-dev:0.0.2
environment: &env
# default bundle config resolves to /usr/local/bundle/config inside of the container
# we are setting it to local app directory if we need to use 'bundle config local'
BUNDLE_APP_CONFIG: /srv/ontoportal/ontologies_api/.bundle
BUNDLE_PATH: /srv/ontoportal/bundle
COVERAGE: 'true'
OVERRIDE_CONFIG: 'true'
# OVERRIDE_CONNECT_GOO: 'true'
REDIS_HOST: 'redis-ut'
REDIS_HOST: redis-ut
REDIS_PORT: 6379
SOLR_HOST: 'solr-ut'
SOLR_TERM_SEARCH_URL: http://solr-ut:8983/solr/term_search_core1
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr/prop_search_core1
stdin_open: true
tty: true
command: "/bin/bash"
command: /bin/bash
volumes:
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
- bundle:/srv/ontoportal/bundle
- .:/srv/ontoportal/ontologies_linked_data
# mount directory containing development version of the gems if you need to use 'bundle config local'
#- /Users/alexskr/ontoportal:/Users/alexskr/ontoportal
depends_on:
- solr-ut
- redis-ut
Expand All @@ -36,7 +41,7 @@ services:
GOO_PATH_DATA: /data/
GOO_PATH_UPDATE: /update/
profiles:
- '4store'
- 4store
depends_on:
- solr-ut
- redis-ut
Expand All @@ -54,7 +59,7 @@ services:
GOO_PATH_DATA: /repositories/bioportal_test/statements
GOO_PATH_UPDATE: /repositories/bioportal_test/statements
profiles:
- 'agraph'
- agraph
depends_on:
- solr-ut
- redis-ut
Expand Down

0 comments on commit 0356ef8

Please sign in to comment.