Skip to content

Commit eb9efc3

Browse files
Merge branch 'upstream' into pl/feature-instances
2 parents 6149728 + 052e176 commit eb9efc3

59 files changed

Lines changed: 10227 additions & 42 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Ruby Unit Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up solr configsets
13+
run: test/solr/generate_ncbo_configsets.sh
14+
- name: create config.rb file
15+
run: cp config/config.rb.sample config/config.rb
16+
- name: Build docker-compose
17+
run: docker-compose build
18+
- name: Run unit tests
19+
run: docker-compose up --exit-code-from unit-test
20+

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ test/test_run.log
3030
create_permissions.log
3131

3232
# jEnv
33-
.java-version
33+
.java-version
34+
35+
# solr configsets, these are generated with a script
36+
test/solr/configsets/term_search
37+
test/solr/configsets/property_search

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ruby:2.6
2+
3+
RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends vim openjdk-11-jre-headless raptor2-utils
4+
# The Gemfile Caching Trick
5+
RUN mkdir -p /srv/ontoportal/ontologies_linked_data
6+
COPY Gemfile* /srv/ontoportal/ontologies_linked_data/
7+
WORKDIR /srv/ontoportal/ontologies_linked_data
8+
RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
9+
RUN bundle install --binstubs
10+
11+
COPY . /srv/ontoportal/ontologies_linked_data
12+
13+
# unit tests have to run with unprivileged user
14+
# otherwise TestOWLApi#test_command_KO_output test fails
15+
RUN adduser --disabled-password ontoportal
16+
RUN chown -R ontoportal /srv/ontoportal/ontologies_linked_data
17+
USER ontoportal

Gemfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
source 'https://rubygems.org'
22

3-
gem 'activesupport', '~> 4.0'
3+
gem 'activesupport', '~> 4'
44
gem 'addressable', '= 2.3.5'
55
gem 'bcrypt', '~> 3.0'
66
gem 'cube-ruby', require: 'cube'
7+
gem 'faraday', '~> 1.9'
78
gem 'ffi'
89
gem 'libxml-ruby', '~> 2.0'
9-
gem 'minitest', '~> 4.0'
10+
gem 'minitest'
1011
gem 'multi_json', '~> 1.0'
1112
gem 'oj', '~> 2.0'
1213
gem 'omni_logger'

Gemfile.lock

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ GEM
5454
coderay (1.1.3)
5555
concurrent-ruby (1.1.9)
5656
cube-ruby (0.0.3)
57-
daemons (1.4.0)
57+
daemons (1.4.1)
5858
docile (1.4.0)
5959
domain_name (0.5.20190701)
6060
unf (>= 0.0.5, < 1.0.0)
@@ -70,50 +70,54 @@ GEM
7070
htmlentities (~> 4.3.3)
7171
launchy (~> 2.1)
7272
mail (~> 2.7)
73-
ethon (0.14.0)
73+
ethon (0.15.0)
7474
ffi (>= 1.15.0)
7575
eventmachine (1.2.7)
76-
faraday (1.7.0)
76+
faraday (1.9.3)
7777
faraday-em_http (~> 1.0)
7878
faraday-em_synchrony (~> 1.0)
7979
faraday-excon (~> 1.1)
80-
faraday-httpclient (~> 1.0.1)
80+
faraday-httpclient (~> 1.0)
81+
faraday-multipart (~> 1.0)
8182
faraday-net_http (~> 1.0)
82-
faraday-net_http_persistent (~> 1.1)
83+
faraday-net_http_persistent (~> 1.0)
8384
faraday-patron (~> 1.0)
8485
faraday-rack (~> 1.0)
85-
multipart-post (>= 1.2, < 3)
86+
faraday-retry (~> 1.0)
8687
ruby2_keywords (>= 0.0.4)
8788
faraday-em_http (1.0.0)
8889
faraday-em_synchrony (1.0.0)
8990
faraday-excon (1.1.0)
9091
faraday-httpclient (1.0.1)
92+
faraday-multipart (1.0.3)
93+
multipart-post (>= 1.2, < 3)
9194
faraday-net_http (1.0.1)
9295
faraday-net_http_persistent (1.2.0)
9396
faraday-patron (1.0.0)
9497
faraday-rack (1.0.0)
95-
ffi (1.15.3)
96-
hashie (4.1.0)
98+
faraday-retry (1.0.3)
99+
ffi (1.15.5)
100+
hashie (5.0.0)
97101
htmlentities (4.3.4)
98102
http-accept (1.7.0)
99103
http-cookie (1.0.4)
100104
domain_name (~> 0.5)
101105
i18n (0.9.5)
102106
concurrent-ruby (~> 1.0)
103-
json_pure (2.5.1)
107+
json_pure (2.6.1)
104108
launchy (2.4.3)
105109
addressable (~> 2.3)
106110
libxml-ruby (2.9.0)
107-
logger (1.4.3)
111+
logger (1.5.0)
108112
macaddr (1.7.2)
109113
systemu (~> 2.6.5)
110114
mail (2.7.1)
111115
mini_mime (>= 0.1.1)
112116
method_source (1.0.0)
113-
mime-types (3.3.1)
117+
mime-types (3.4.1)
114118
mime-types-data (~> 3.2015)
115-
mime-types-data (3.2021.0704)
116-
mini_mime (1.1.0)
119+
mime-types-data (3.2022.0105)
120+
mini_mime (1.1.2)
117121
minitest (4.7.5)
118122
minitest-reporters (0.14.24)
119123
ansi
@@ -128,8 +132,8 @@ GEM
128132
oj (2.18.5)
129133
omni_logger (0.1.4)
130134
logger
131-
parallel (1.20.1)
132-
parser (3.0.2.0)
135+
parallel (1.21.0)
136+
parser (3.1.0.0)
133137
ast (~> 2.4.1)
134138
pony (1.13.1)
135139
mail (>= 2.0)
@@ -141,13 +145,13 @@ GEM
141145
rack (1.6.13)
142146
rack-test (0.8.3)
143147
rack (>= 1.0, < 3)
144-
rainbow (3.0.0)
148+
rainbow (3.1.1)
145149
rake (10.5.0)
146150
rdf (1.0.8)
147151
addressable (>= 2.2)
148-
redis (4.4.0)
152+
redis (4.6.0)
149153
ref (2.0.0)
150-
regexp_parser (2.1.1)
154+
regexp_parser (2.2.0)
151155
rest-client (2.1.0)
152156
http-accept (>= 1.7.0, < 2.0)
153157
http-cookie (>= 1.0.2, < 2.0)
@@ -156,22 +160,22 @@ GEM
156160
rexml (3.2.5)
157161
rsolr (1.1.2)
158162
builder (>= 2.1.2)
159-
rubocop (1.18.4)
163+
rubocop (1.25.0)
160164
parallel (~> 1.10)
161-
parser (>= 3.0.0.0)
165+
parser (>= 3.1.0.0)
162166
rainbow (>= 2.2.2, < 4.0)
163167
regexp_parser (>= 1.8, < 3.0)
164168
rexml
165-
rubocop-ast (>= 1.8.0, < 2.0)
169+
rubocop-ast (>= 1.15.1, < 2.0)
166170
ruby-progressbar (~> 1.7)
167171
unicode-display_width (>= 1.4.0, < 3.0)
168-
rubocop-ast (1.9.0)
172+
rubocop-ast (1.15.1)
169173
parser (>= 3.0.1.1)
170174
ruby-progressbar (1.11.0)
171-
ruby-xxHash (0.4.0.1)
175+
ruby-xxHash (0.4.0.2)
172176
ruby2_keywords (0.0.5)
173177
rubyzip (1.3.0)
174-
sequel (5.47.0)
178+
sequel (5.53.0)
175179
simplecov (0.21.2)
176180
docile (~> 1.1)
177181
simplecov-html (~> 0.11)
@@ -191,25 +195,25 @@ GEM
191195
tzinfo (0.3.60)
192196
unf (0.1.4)
193197
unf_ext
194-
unf_ext (0.0.7.7)
195-
unicode-display_width (2.0.0)
198+
unf_ext (0.0.8)
199+
unicode-display_width (2.1.0)
196200
uuid (2.3.9)
197201
macaddr (~> 1.0)
198202

199203
PLATFORMS
200204
ruby
201-
x86_64-darwin-17
202205

203206
DEPENDENCIES
204-
activesupport (~> 4.0)
207+
activesupport (~> 4)
205208
addressable (= 2.3.5)
206209
bcrypt (~> 3.0)
207210
cube-ruby
208211
email_spec
212+
faraday (~> 1.9)
209213
ffi
210214
goo!
211215
libxml-ruby (~> 2.0)
212-
minitest (~> 4.0)
216+
minitest
213217
minitest-reporters (>= 0.5.0)
214218
multi_json (~> 1.0)
215219
ncbo_resource_index!

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
require 'rake/testtask'
22

3+
task default: %w[test]
4+
35
Rake::TestTask.new do |t|
46
t.libs = []
57
t.test_files = FileList['test/**/test*.rb']

docker-compose.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: '3'
2+
3+
services:
4+
unit-test:
5+
# volumes:
6+
# - .:/srv/ontoportal/ontologies_linked_data
7+
build: .
8+
#command: "bundle exec rake test TESTOPTS='-v' TEST='./test/parser/test_owl_api_command.rb'"
9+
environment:
10+
- GOO_BACKEND_NAME=4store
11+
- GOO_PORT=9000
12+
- GOO_HOST=4store
13+
- GOO_PATH_QUERY=/sparql/
14+
- GOO_PATH_DATA=/data/
15+
- GOO_PATH_UPDATE=/update/
16+
- OVERRIDE_CONNECT_GOO=true
17+
- REDIS_HOST=redis
18+
- REDIS_PORT=6379
19+
- SOLR_HOST=solr
20+
command: "bundle exec rake test TESTOPTS='-v'"
21+
depends_on:
22+
- solr
23+
- redis
24+
- 4store
25+
26+
redis:
27+
image: redis
28+
29+
4store:
30+
image: bde2020/4store
31+
ports:
32+
- "9000:9000"
33+
command: >
34+
bash -c "4s-backend-setup --segments 4 ontoportal_kb
35+
&& 4s-backend ontoportal_kb
36+
&& 4s-httpd -D -s-1 -p 9000 ontoportal_kb"
37+
38+
solr:
39+
image: solr:8.8
40+
volumes:
41+
- ./test/solr/configsets:/configsets:ro
42+
ports:
43+
- "8983:8983"
44+
command: >
45+
bash -c "precreate-core term_search_core1 /configsets/term_search
46+
&& precreate-core prop_search_core1 /configsets/property_search
47+
&& solr-foreground"
48+
49+
# mgrep:
50+
# image: ontoportal/mgrep-ncbo:0.1

lib/ontologies_linked_data/parser/owlapi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class RDFFileNotGeneratedException < Parser::ParserException
1313

1414
class OWLAPICommand
1515
def initialize(input_file, output_repo, opts = {})
16-
@owlapi_wrapper_jar_path = LinkedData.bindir + "/owlapi-wrapper-1.3.6.jar"
16+
@owlapi_wrapper_jar_path = LinkedData.bindir + "/owlapi-wrapper-1.3.7.jar"
1717
@input_file = input_file
1818
@output_repo = output_repo
1919
@master_file = opts[:master_file]

run-unit-tests.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# sample script to run unit tests with docker
3+
4+
#generate solr configsets
5+
test/solr/generate_ncbo_configsets.sh
6+
7+
# build docker env
8+
docker-compose build
9+
# start up all containers and exit with exit code from unit-test container which runs unit tests
10+
docker-compose up --exit-code-from unit-test
11+
#docker-compose run --rm ont_ld bundle exec rake test TESTOPTS='-v'

0 commit comments

Comments
 (0)