Skip to content

Commit

Permalink
fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Jul 3, 2024
1 parent 7531e10 commit b75f425
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 64 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
source 'https://rubygems.org'

gem 'cube-ruby'
gem 'faraday', '~> 1.9'
gem 'ffi'
gem 'oj', '~> 3.0'
gem 'rake', '~> 10.0'
gem 'redis'
gem 'ruby-xxHash'

group :development do
Expand Down
69 changes: 24 additions & 45 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 33583fd1c1d72b449cd6bb91815e3422b8448983
revision: 70007faf43d0d96292809f89f15a27a757ccaa25
branch: develop
specs:
goo (0.0.2)
Expand All @@ -16,7 +16,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: da1642ed8f9f04db2e427e35d88f235a55138d03
revision: 013a322440b4cfd899908d15ff605799acf8e6ef
branch: develop
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -53,44 +53,26 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.7)
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.3)
connection_pool (2.4.1)
cube-ruby (0.0.3)
date (3.3.4)
docile (1.4.0)
domain_name (0.6.20240107)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.16.3)
faraday-net_http (3.0.2)
http-accept (1.7.0)
http-cookie (1.0.5)
http-cookie (1.0.6)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
Expand All @@ -108,13 +90,12 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
mime-types-data (3.2024.0702)
mini_mime (1.1.5)
minitest (4.7.5)
multi_json (1.15.0)
multipart-post (2.4.0)
net-http-persistent (2.9.4)
net-imap (0.4.10)
net-imap (0.4.14)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -124,7 +105,7 @@ GEM
net-smtp (0.5.0)
net-protocol
netrc (0.11.0)
oj (3.16.3)
oj (3.16.4)
bigdecimal (>= 3.0)
omni_logger (0.1.4)
logger
Expand All @@ -133,25 +114,26 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.5)
rack (3.0.10)
public_suffix (5.1.1)
rack (3.1.6)
rack-test (2.1.0)
rack (>= 1.3)
rake (10.5.0)
rdf (1.0.8)
addressable (>= 2.2)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.1)
redis-client (0.22.2)
connection_pool
request_store (1.6.0)
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)
rexml (3.3.1)
strscan
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand All @@ -167,6 +149,7 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
strscan (3.1.0)
systemu (2.6.5)
thread_safe (0.3.6)
timeout (0.4.1)
Expand All @@ -175,20 +158,16 @@ GEM
macaddr (~> 1.0)

PLATFORMS
ruby
aarch64-linux
x86_64-linux

DEPENDENCIES
cube-ruby
faraday (~> 1.9)
ffi
goo!
minitest (~> 4.0)
oj (~> 3.0)
ontologies_linked_data!
pry
rake (~> 10.0)
redis
ruby-xxHash
simplecov
simplecov-cobertura
Expand Down
44 changes: 44 additions & 0 deletions dip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '7.1'

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

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

# Run a container without any dependent services
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 TESTOPTS='-v'

test-agraph:
description: Run minitest unit tests
service: ruby-agraph
command: bundle exec rake test TESTOPTS='-v'

'redis-cli':
description: Run Redis console
service: redis-ut
command: redis-cli -h redis-ut
21 changes: 10 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

x-app: &app
build:
context: .
Expand All @@ -15,6 +13,7 @@ x-app: &app
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr/prop_search_core1
volumes:
- .:/srv/ontoportal/ncbo_annotator
- bundle:/bundle
stdin_open: true
tty: true
command: "bundle exec rake test TESTOPTS='-v'"
Expand Down Expand Up @@ -48,9 +47,9 @@ services:
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
GOO_PATH_QUERY: /repositories/ontoportal_test
GOO_PATH_DATA: /repositories/ontoportal_test/statements
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
depends_on:
<<: *depends_on
agraph-ut:
Expand All @@ -59,7 +58,7 @@ services:
- agraph

solr-ut:
image: ontoportal/solr-ut:0.0.2
image: ontoportal/solr-ut:0.2.0
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: 3s
Expand All @@ -79,7 +78,7 @@ services:
image: ontoportal/mgrep:0.0.2
platform: linux/amd64
healthcheck:
test: ["CMD", "nc", "-z", "-v", "localhost", "55556"]
test: ["CMD", "nc", "-z", "-v", "127.0.0.1", "55556"]
start_period: 3s
interval: 10s
timeout: 5s
Expand All @@ -96,20 +95,20 @@ services:
- 4store

agraph-ut:
image: franzinc/agraph:v8.0.0
image: franzinc/agraph:v8.2.0
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
- AGRAPH_SUPER_PASSWORD=xyzzy
shm_size: 1g
command: >
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
; agtool repos create bioportal_test
; agtool repos create --supersede ontoportal_test
; agtool users add anonymous
; agtool users grant anonymous root:bioportal_test:rw
; agtool users grant anonymous root:ontoportal_test:rw
; tail -f /agraph/data/agraph.log"
healthcheck:
test: ["CMD-SHELL", "agtool storage-report bioportal_test || exit 1"]
test: ["CMD-SHELL", "agtool storage-report ontoportal_test || exit 1"]
start_period: 30s
interval: 10s
timeout: 5s
Expand Down
4 changes: 2 additions & 2 deletions lib/ncbo_annotator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ def generate_dictionary_file()
end

outFile.close
redis_mgrep_dict_refresh_timestamp()
redis_mgrep_dict_refresh_timestamp
end

@logger.info("Completed generating a dictionary file in #{(time/60).round(1)} minutes.")
@logger.info("Completed generating a dictionary file in #{time.round(2)} seconds.")
end

def create_term_cache_from_ontologies(ontologies, delete_cache=false, redis_prefix=nil)
Expand Down
4 changes: 2 additions & 2 deletions test/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def self.ontologies
def before_suites
# code to run before the very first test
LinkedData::SampleData::Ontology.delete_ontologies_and_submissions
@@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies
@@sty = LinkedData::SampleData::Ontology.load_semantic_types_ontology
@@ontologies = LinkedData::SampleData::Ontology.sample_owl_ontologies(process_submission: true)
@@sty = LinkedData::SampleData::Ontology.load_semantic_types_ontology(process_submission: true)
annotator = Annotator::Models::NcboAnnotator.new
annotator.init_redis_for_tests
annotator.create_term_cache_from_ontologies(@@ontologies, true)
Expand Down

0 comments on commit b75f425

Please sign in to comment.