Skip to content

Commit

Permalink
set up multiple triple store test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 26, 2023
1 parent 37408c5 commit d30be5b
Show file tree
Hide file tree
Showing 6 changed files with 269 additions and 122 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,37 @@ on:
jobs:
test:
strategy:
fail-fast: false
matrix:
backend: ['api'] # api runs tests with 4store backend and api-agraph runs with AllegroGraph backend
goo-slice: [ '20', '100', '500' ]
ruby-version: [ '2.7' ]
triplestore: [ 'fs', 'ag', 'vo', 'gb' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build docker-compose
run: docker-compose --profile 4store build #profile flag is set in order to build all containers in this step
- name: Run unit tests
# unit tests are run inside a container
# http://docs.codecov.io/docs/testing-with-docker
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker-compose run $ci_env -e CI --rm ${{ matrix.backend }} wait-for-it solr-ut:8983 -- bundle exec rake test TESTOPTS='-v'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
verbose: true
fail_ci_if_error: false # optional (default = false)
- uses: actions/checkout@v3
- name: Set up solr configsets
run: ./test/solr/generate_ncbo_configsets.sh
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get -y install raptor2-utils
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run unit tests
# unit tests are run inside a container
# http://docs.codecov.io/docs/testing-with-docker
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
GOO_SLICES=${{ matrix.goo-slice }} bundle exec rake test:docker:${{ matrix.triplestore }} TESTOPTS="-v"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
verbose: true
fail_ci_if_error: false # optional (default = false)
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'activesupport', '~> 3.1'
gem 'activesupport', '~> 3.2'
# see https://github.com/ncbo/ontologies_api/issues/69
gem 'bigdecimal', '1.4.2'
gem 'faraday', '~> 1.9'
Expand Down Expand Up @@ -44,12 +44,12 @@ gem 'haml', '~> 5.2.2' # pin see https://github.com/ncbo/ontologies_api/pull/107
gem 'redcarpet'

# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'goo', git: 'https://github.com/ontoportal-lirmm/goo.git', branch: 'development'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'feature/migrate-to-virtuso'
gem 'ncbo_annotator', git: 'https://github.com/ontoportal-lirmm/ncbo_annotator.git', branch: 'master'
gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branch: 'master'
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'master'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/migrate-to-virtuoso'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/goo.git
revision: 69466682c1e9cb2c338539195013dbec9714ca7d
branch: development
revision: 62b027bb6c0c084b3e1288f33334e565c94b193c
branch: feature/migrate-to-virtuso
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -53,8 +53,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 087c28b92527a1df1665d25c38277456e9acf06e
branch: development
revision: 189f5898e1e2422a647f3937495c3ea1c9894350
branch: feature/migrate-to-virtuoso
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down Expand Up @@ -112,7 +112,7 @@ GEM
bcrypt_pbkdf (1.1.0)
bigdecimal (1.4.2)
builder (3.2.4)
capistrano (3.17.3)
capistrano (3.18.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
Expand Down Expand Up @@ -216,7 +216,7 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (2.9.4)
net-imap (0.4.1)
net-imap (0.4.2)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -352,7 +352,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
activesupport (~> 3.1)
activesupport (~> 3.2)
bcrypt_pbkdf (>= 1.0, < 2.0)
bigdecimal (= 1.4.2)
capistrano (~> 3)
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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"
SOLR_PROP_SEARCH_URL = ENV.include?("SOLR_PROP_SEARCH_URL") ? ENV["SOLR_PROP_SEARCH_URL"] : "http://localhost:8984/solr/prop_search_core1"
MGREP_HOST = ENV.include?("MGREP_HOST") ? ENV["MGREP_HOST"] : "localhost"
MGREP_PORT = ENV.include?("MGREP_PORT") ? ENV["MGREP_PORT"] : 55555

Expand Down
215 changes: 120 additions & 95 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,154 @@
x-app: &app
build:
context: .
args:
RUBY_VERSION: '2.7'
# Increase the version number in the image tag every time Dockerfile or its arguments is changed
image: ontologies_api:0.0.1
environment: &env
BUNDLE_PATH: /srv/ontoportal/bundle
# 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
COVERAGE: 'true'
GOO_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
MGREP_HOST: mgrep-ut
MGREP_PORT: 55555
stdin_open: true
tty: true
command: "bundle exec rackup -o 0.0.0.0 --port 9393"
ports:
- 9393:9393
volumes:
# bundle volume for hosting gems installed by bundle; it helps in local development with gem udpates
- bundle:/srv/ontoportal/bundle
# api code
- .:/srv/ontoportal/ontologies_api
# 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
- mgrep-ut
build:
context: .
args:
RUBY_VERSION: '2.7'
# 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' # enable simplecov code coverage
REDIS_HOST: redis-ut
REDIS_PORT: 6379
SOLR_TERM_SEARCH_URL: http://solr-term-ut:8983/solr/term_search_core1
SOLR_PROP_SEARCH_URL: http://solr-prop-ut:8983/solr/prop_search_core1
stdin_open: true
tty: true
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: &depends_on
solr-prop-ut:
condition: service_healthy
solr-term-ut:
condition: service_healthy
redis-ut:
condition: service_healthy

services:
api:
<<: *app
environment:
<<: *env
GOO_BACKEND_NAME: 4store
GOO_PORT: 9000
GOO_HOST: 4store-ut
GOO_PATH_QUERY: /sparql/
GOO_PATH_DATA: /data/
GOO_PATH_UPDATE: /update/
profiles:
- 4store
depends_on:
- solr-ut
- redis-ut
- mgrep-ut
- 4store-ut

api-agraph:
<<: *app
environment:
<<: *env
GOO_BACKEND_NAME: ag
GOO_PORT: 10035
GOO_HOST: agraph-ut
GOO_PATH_QUERY: /repositories/bioportal_test
GOO_PATH_DATA: /repositories/bioportal_test/statements
GOO_PATH_UPDATE: /repositories/bioportal_test/statements
profiles:
- agraph
depends_on:
- solr-ut
- redis-ut
- mgrep-ut
- agraph-ut

redis-ut:
image: redis
ports:
- 6379:6379
- "6379:6379"
command: [ "redis-server", "--save", "", "--appendonly", "no" ]
healthcheck:
test: redis-cli ping
interval: 10s
timeout: 3s
retries: 10

4store-ut:
image: bde2020/4store
#volume: fourstore:/var/lib/4store
ports:
- 9000:9000
command: >
bash -c "4s-backend-setup --segments 4 ontoportal_kb
&& 4s-backend ontoportal_kb
&& 4s-httpd -D -s-1 -p 9000 ontoportal_kb"
ports:
- "9000:9000"
profiles:
- 4store

- fs

solr-ut:
solr-term-ut:
image: solr:8
volumes:
- ./test/solr/configsets:/configsets:ro
ports:
- "8983:8983"
command: >
bash -c "precreate-core term_search_core1 /configsets/term_search
&& precreate-core prop_search_core1 /configsets/property_search
&& solr-foreground"
command: [ "solr-precreate", "term_search_core1", "/configsets/term_search" ]
healthcheck:
test: [ "CMD-SHELL", "curl -sf http://localhost:8983/solr/term_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1" ]
start_period: 5s
interval: 10s
timeout: 5s
retries: 5

mgrep-ut:
image: ontoportal/mgrep-ncbo:0.1
solr-prop-ut:
image: solr:8
volumes:
- ./test/solr/configsets:/configsets:ro
ports:
- "55556:55555"
- "8984:8983"
command: [ "solr-precreate", "prop_search_core1", "/configsets/property_search" ]
healthcheck:
test: [ "CMD-SHELL", "curl -sf http://localhost:8983/solr/prop_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1" ]
start_period: 5s
interval: 10s
timeout: 5s
retries: 5

agraph-ut:
image: franzinc/agraph:v7.3.0
image: franzinc/agraph:v8.0.0.rc1
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
- AGRAPH_SUPER_PASSWORD=xyzzy
shm_size: 1g
# ports:
# - 10035:10035
ports:
# - 10035:10035
- 10000-10035:10000-10035
volumes:
- agdata:/agraph/data
# - ./agraph/etc:/agraph/etc
command: >
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
; agtool repos create bioportal_test
; agtool users add anonymous
; agtool users grant anonymous root:bioportal_test:rw
; tail -f /agraph/data/agraph.log"
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
; agtool repos create ontoportal_test --supersede
; agtool users add anonymous
; agtool users grant anonymous root:ontoportal_test:rw
; tail -f /agraph/data/agraph.log"
# healthcheck:
# test: ["CMD-SHELL", "curl -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1"]
# start_period: 10s
# interval: 10s
# timeout: 5s
# retries: 5
profiles:
- ag

virtuoso-ut:
image: tenforce/virtuoso:virtuoso7.2.5
platform: linux/amd64
environment:
- SPARQL_UPDATE=true
ports:
- 1111:1111
- 8890:8890
profiles:
- vo
healthcheck:
test: [ "CMD-SHELL", "curl -sf http://localhost:8890/sparql || exit 1" ]
start_period: 10s
interval: 60s
timeout: 5s
retries: 3

graphdb-ut:
image: ontotext/graphdb:10.3.3
platform: linux/amd64
privileged: true
environment:
GDB_HEAP_SIZE: 5G
GDB_JAVA_OPTS: >-
-Xms5g -Xmx5g
ports:
- 7200:7200
- 7300:7300
volumes:
- ./test/data/graphdb-repo-config.ttl:/opt/graphdb/dist/configs/templates/data/graphdb-repo-config.ttl
- ./test/data/graphdb-test-load.nt:/opt/graphdb/dist/configs/templates/data/graphdb-test-load.nt

entrypoint: >
bash -c " importrdf load -f -c /opt/graphdb/dist/configs/templates/data/graphdb-repo-config.ttl -m parallel /opt/graphdb/dist/configs/templates/data/graphdb-test-load.nt ; graphdb -Ddefault.min.distinct.threshold=3000 "
profiles:
- agraph
- gb

volumes:
bundle:
#fourstore:
agdata:
Loading

0 comments on commit d30be5b

Please sign in to comment.