Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Oct 3, 2024
1 parent d2f91c4 commit ad53e3e
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 91 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ on:

jobs:
test:
strategy:
fail-fast: false
matrix:
backend: ['ruby', 'ruby-agraph'] # ruby runs tests with 4store backend and ruby-agraph runs with AllegroGraph backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: copy config file
run: cp config/config.test.rb config/config.rb
- uses: actions/checkout@v4
- name: copy config.rb file from template
run: cp config/config.test.rb config/config.rb
- name: Build docker compose
run: docker compose build
- 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 ruby bundle exec rake test TESTOPTS='-v'
docker compose run $ci_env -e CI --rm ${{ matrix.backend }} bundle exec rake test TESTOPTS='-v'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
verbose: true
fail_ci_if_error: false # optional (default = false)
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.6
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION
ARG RUBY_VERSION=3.0
ARG DISTRO_NAME=bullseye

FROM ruby:$RUBY_VERSION-$DISTRO_NAME
Expand All @@ -8,16 +8,16 @@ RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
raptor2-utils \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /srv/ontoportal/ncbo_ontology_recommender
RUN mkdir -p /srv/ontoportal/bundle
COPY Gemfile* *.gemspec /srv/ontoportal/ncbo_ontology_recommender/
ENV BUNDLE_PATH=/usr/local/bundle \
BUNDLE_BIN=/usr/local/bundle/bin \
BUNDLE_APP_CONFIG=/usr/local/bundle/config

WORKDIR /srv/ontoportal/ncbo_ontology_recommender
WORKDIR /usr/src/app

COPY Gemfile* *.gemspec ./

RUN gem update --system
RUN gem install bundler
ENV BUNDLE_PATH=/srv/ontoportal/bundle
RUN bundle install

COPY . /srv/ontoportal/ncbo_ontology_recommender
CMD ["/bin/bash"]
COPY . .
CMD ["irb"]
87 changes: 49 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 4ea0e70a4361fc694700e11f1012129452278c7d
revision: 74a012eebb9433d031eb00df5abbe488cb8b4512
branch: develop
specs:
goo (0.0.2)
addressable (~> 2.8)
pry
rdf (= 1.0.8)
redis
request_store
rest-client
rsolr
sparql-client
uuid

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: b111a1d5b61d112ad6752f17d3ad94c9c3cf69db
revision: b2731c98bfef0958fecb440c8648b7755a670895
branch: develop
specs:
ncbo_annotator (0.0.1)
Expand All @@ -26,7 +27,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 2575a6ecf62f6f1161f103429fc278939630ad87
revision: 812dd78f02b77c9c6d579b0febf1c2a42d513022
branch: develop
specs:
ontologies_linked_data (0.0.1)
Expand All @@ -46,7 +47,7 @@ GIT

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: 55e7dbf858eb571c767bc67868f9af61663859cb
revision: 1657f0dd69fd4b522d3549a6848670175f5e98cc
branch: develop
specs:
sparql-client (1.0.1)
Expand All @@ -63,90 +64,99 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
bcrypt (3.1.20)
bigdecimal (3.1.6)
builder (3.2.4)
bigdecimal (3.1.8)
builder (3.3.0)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
cube-ruby (0.0.3)
date (3.3.4)
docile (1.4.0)
docile (1.4.1)
domain_name (0.6.20240107)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.16.3)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-net_http (3.3.0)
net-http
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
http-accept (1.7.0)
http-cookie (1.0.5)
http-cookie (1.0.7)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (2.7.1)
json_pure (2.7.1)
libxml-ruby (5.0.2)
logger (1.6.0)
json (2.7.2)
json_pure (2.7.2)
libxml-ruby (5.0.3)
logger (1.6.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
method_source (1.0.0)
mime-types (3.5.2)
method_source (1.1.0)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0206)
mime-types-data (3.2024.1001)
mini_mime (1.1.5)
minitest (4.7.5)
multi_json (1.15.0)
net-http (0.4.1)
uri
net-http-persistent (2.9.4)
net-imap (0.3.7)
net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
netrc (0.11.0)
oj (3.16.3)
oj (3.16.6)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
omni_logger (0.1.4)
logger
ostruct (0.6.0)
pony (1.13.1)
mail (>= 2.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.4)
rack (3.0.9.1)
public_suffix (6.0.1)
rack (3.1.7)
rack-test (2.1.0)
rack (>= 1.3)
rake (10.5.0)
rdf (1.0.8)
addressable (>= 2.2)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
request_store (1.7.0)
rack (>= 1.4)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.6)
rsolr (2.5.0)
rexml (3.3.8)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
ruby-xxHash (0.4.0.2)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -155,12 +165,13 @@ GEM
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
systemu (2.6.5)
thread_safe (0.3.6)
timeout (0.4.1)
tzinfo (0.3.62)
uri (0.13.1)
uuid (2.3.9)
macaddr (~> 1.0)

Expand Down Expand Up @@ -188,4 +199,4 @@ DEPENDENCIES
sparql-client!

BUNDLED WITH
2.3.15
2.5.21
37 changes: 25 additions & 12 deletions config/config.test.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
# frozen_string_literal: true

#
# This file is designed for used for 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_HOST = ENV.include?('GOO_HOST') ? ENV['GOO_HOST'] : 'localhost'
GOO_PORT = ENV.include?('GOO_PORT') ? ENV['GOO_PORT'] : 9000
REDIS_HOST = ENV.include?('REDIS_HOST') ? ENV['REDIS_HOST'] : 'localhost'
REDIS_PORT = ENV.include?('REDIS_PORT') ? ENV['REDIS_PORT'] : 6379
SOLR_HOST = ENV.include?('SOLR_HOST') ? ENV['SOLR_HOST'] : 'localhost'
MGREP_HOST = ENV.include?('MGREP_HOST') ? ENV['MGREP_HOST'] : 'localhost'
MGREP_PORT = ENV.include?('MGREP_PORT') ? ENV['MGREP_PORT'] : 55555
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
MGREP_HOST = ENV.include?('MGREP_HOST') ? ENV['MGREP_HOST'] : 'localhost'
MGREP_PORT = ENV.include?('MGREP_PORT') ? ENV['MGREP_PORT'] : 55556
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_host = GOO_HOST.to_s
config.goo_port = GOO_PORT.to_i
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 = "http://#{SOLR_HOST}:8983/solr/term_search_core1".to_s
config.property_search_server_url = "http://#{SOLR_HOST}:8983/solr/prop_search_core1".to_s
config.search_server_url = SOLR_TERM_SEARCH_URL.to_s
config.property_search_server_url = SOLR_PROP_SEARCH_URL.to_s
end

Annotator.config do |config|
config.mgrep_host = MGREP_HOST.to_s
config.mgrep_port = MGREP_PORT.to_i
Expand Down
Loading

0 comments on commit ad53e3e

Please sign in to comment.