Skip to content

Commit fccf482

Browse files
committed
chore: refactor docker-based test runner and add linux container tests
see ncbo/goo#173
1 parent c60f8bc commit fccf482

10 files changed

Lines changed: 191 additions & 94 deletions

File tree

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG RUBY_VERSION=3.1
1+
ARG RUBY_VERSION=3.2
22
ARG DISTRO=bullseye
33

44
FROM ruby:$RUBY_VERSION-$DISTRO
@@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
88
git \
99
libxml2 \
1010
libxslt-dev \
11+
libxslt1-dev zlib1g-dev \
1112
openjdk-11-jre-headless \
1213
raptor2-utils \
1314
&& rm -rf /var/lib/apt/lists/*

dev/compose/linux/ag.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
test-linux:
3+
environment:
4+
GOO_BACKEND_NAME: allegrograph
5+
GOO_PORT: 10035
6+
GOO_HOST: agraph-ut
7+
GOO_PATH_QUERY: /repositories/ontoportal_test
8+
GOO_PATH_DATA: /repositories/ontoportal_test/statements
9+
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
10+
depends_on:
11+
solr-ut:
12+
condition: service_healthy
13+
redis-ut:
14+
condition: service_healthy
15+
agraph-ut:
16+
condition: service_healthy

dev/compose/linux/fs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
test-linux:
3+
environment:
4+
GOO_BACKEND_NAME: '4store'
5+
GOO_HOST: 4store-ut
6+
GOO_PORT: 9000
7+
depends_on:
8+
solr-ut:
9+
condition: service_healthy
10+
redis-ut:
11+
condition: service_healthy
12+
4store-ut:
13+
condition: service_healthy

dev/compose/linux/gd.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
test-linux:
3+
environment:
4+
GOO_BACKEND_NAME: graphdb
5+
GOO_PORT: 7200
6+
GOO_HOST: graphdb-ut
7+
GOO_PATH_QUERY: /repositories/ontoportal_test
8+
GOO_PATH_DATA: /repositories/ontoportal_test/statements
9+
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
10+
depends_on:
11+
solr-ut:
12+
condition: service_healthy
13+
redis-ut:
14+
condition: service_healthy
15+
graphdb-ut:
16+
condition: service_healthy

dev/compose/linux/no-ports.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
redis-ut:
3+
ports: []
4+
solr-ut:
5+
ports: []
6+
agraph-ut:
7+
ports: []
8+
4store-ut:
9+
ports: []
10+
virtuoso-ut:
11+
ports: []
12+
graphdb-ut:
13+
ports: []

dev/compose/linux/vo.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
test-linux:
3+
environment:
4+
GOO_BACKEND_NAME: 'virtuoso'
5+
GOO_HOST: virtuoso-ut
6+
GOO_PORT: 8890
7+
GOO_PATH_QUERY: /sparql
8+
GOO_PATH_DATA: /sparql
9+
GOO_PATH_UPDATE: /sparql
10+
depends_on:
11+
solr-ut:
12+
condition: service_healthy
13+
redis-ut:
14+
condition: service_healthy
15+
virtuoso-ut:
16+
condition: service_healthy

docker-compose.yml

Lines changed: 79 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,126 @@
1-
x-app: &app
1+
# unit tests in containerased env
2+
services:
3+
test-linux:
24
build:
35
context: .
46
args:
57
RUBY_VERSION: '3.2'
6-
# Increase the version number in the image tag every time Dockerfile or its arguments is changed
7-
image: ontologies_ld-dev:0.0.4
8-
environment: &env
8+
command: ["bash", "-lc", "bundle exec rake test"]
9+
environment:
910
COVERAGE: 'true' # enable simplecov code coverage
1011
REDIS_HOST: redis-ut
11-
REDIS_PORT: 6379
12-
SOLR_TERM_SEARCH_URL: http://solr-term-ut:8983/solr
13-
SOLR_PROP_SEARCH_URL: http://solr-prop-ut:8983/solr
14-
stdin_open: true
15-
tty: true
16-
command: /bin/bash
17-
volumes:
18-
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
19-
- bundle:/usr/local/bundle
20-
- .:/app
21-
# mount directory containing development version of the gems if you need to use 'bundle config local'
22-
#- /Users/alexskr/ontoportal:/Users/alexskr/ontoportal
23-
depends_on: &depends_on
24-
solr-prop-ut:
25-
condition: service_healthy
26-
solr-term-ut:
12+
SOLR_TERM_SEARCH_URL: http://solr-ut:8983/solr
13+
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr
14+
depends_on:
15+
solr-ut:
2716
condition: service_healthy
2817
redis-ut:
2918
condition: service_healthy
30-
31-
services:
32-
# environment wtih 4store backend
33-
ruby:
34-
<<: *app
35-
environment:
36-
<<: *env
37-
GOO_BACKEND_NAME: 4store
38-
GOO_PORT: 9000
39-
GOO_HOST: 4store-ut
40-
GOO_PATH_QUERY: /sparql/
41-
GOO_PATH_DATA: /data/
42-
GOO_PATH_UPDATE: /update/
4319
profiles:
44-
- 4store
45-
depends_on:
46-
<<: *depends_on
47-
4store-ut:
48-
condition: service_started
49-
50-
# environment with AllegroGraph backend
51-
ruby-agraph:
52-
<<: *app
53-
environment:
54-
<<: *env
55-
GOO_BACKEND_NAME: ag
56-
GOO_PORT: 10035
57-
GOO_HOST: agraph-ut
58-
GOO_PATH_QUERY: /repositories/ontoportal_test
59-
GOO_PATH_DATA: /repositories/ontoportal_test/statements
60-
GOO_PATH_UPDATE: /repositories/ontoportal_test/statements
61-
profiles:
62-
- agraph
63-
depends_on:
64-
<<: *depends_on
65-
agraph-ut:
66-
condition: service_healthy
20+
- linux
6721

6822
redis-ut:
6923
image: redis
24+
ports:
25+
- 6379:6379
7026
command: ["redis-server", "--save", "", "--appendonly", "no"]
7127
healthcheck:
7228
test: redis-cli ping
7329
interval: 10s
7430
timeout: 3s
7531
retries: 10
7632

33+
solr-ut:
34+
image: solr:9
35+
command: bin/solr start -cloud -f
36+
ports:
37+
- 8983:8983
38+
healthcheck:
39+
test: ["CMD", "curl", "-sf", "http://localhost:8983/solr/admin/info/system?wt=json"]
40+
start_period: 5s
41+
interval: 10s
42+
timeout: 5s
43+
retries: 5
44+
7745
4store-ut:
7846
image: bde2020/4store
7947
platform: linux/amd64
48+
ports:
49+
- 9000:9000
8050
command: >
81-
bash -c "4s-backend-setup --segments 4 ontoportal_kb
82-
&& 4s-backend ontoportal_kb
83-
&& 4s-httpd -D -s-1 -p 9000 ontoportal_kb"
84-
profiles:
85-
- 4store
86-
87-
solr-term-ut:
88-
image: solr:8
89-
volumes:
90-
- ./test/solr/configsets:/configsets:ro
91-
# ports:
92-
# - "8983:8983"
93-
command: ["solr-precreate", "term_search_core1", "/configsets/term_search"]
94-
healthcheck:
95-
test: ["CMD-SHELL", "curl -sf http://localhost:8983/solr/term_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1"]
96-
start_period: 5s
97-
interval: 10s
98-
timeout: 5s
99-
retries: 5
100-
101-
solr-prop-ut:
102-
image: solr:8
103-
volumes:
104-
- ./test/solr/configsets:/configsets:ro
105-
# ports:
106-
# - "8984:8983"
107-
command: ["solr-precreate", "prop_search_core1", "/configsets/property_search"]
51+
bash -c "4s-backend-setup --segments 4 ontoportal_test
52+
&& 4s-backend ontoportal_test
53+
&& 4s-httpd -D -s-1 -p 9000 ontoportal_test"
10854
healthcheck:
109-
test: ["CMD-SHELL", "curl -sf http://localhost:8983/solr/prop_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1"]
55+
test: ["CMD", "4s-backend-info", "ontoportal_test"]
11056
start_period: 5s
11157
interval: 10s
112-
timeout: 5s
58+
timeout: 10s
11359
retries: 5
60+
profiles:
61+
- fs
11462

11563
agraph-ut:
116-
image: franzinc/agraph:v8.3.1
117-
platform: linux/amd64
64+
image: franzinc/agraph:v8.4.3
65+
platform: linux/amd64 #agraph doesn't provide arm platform
11866
environment:
11967
- AGRAPH_SUPER_USER=test
12068
- AGRAPH_SUPER_PASSWORD=xyzzy
12169
shm_size: 1g
122-
# ports:
123-
# - 10035:10035
70+
ports:
71+
- 10035:10035
12472
command: >
12573
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
12674
; agtool repos create --supersede ontoportal_test
12775
; agtool users add anonymous
12876
; agtool users grant anonymous root:ontoportal_test:rw
12977
; tail -f /agraph/data/agraph.log"
13078
healthcheck:
131-
test: ["CMD-SHELL", "agtool storage-report ontoportal_test || exit 1"]
79+
test: ["CMD", "agtool", "storage-report", "ontoportal_test"]
13280
start_period: 30s #AllegroGraph can take a loooooong time to start
13381
interval: 20s
13482
timeout: 10s
13583
retries: 20
13684
profiles:
137-
- agraph
85+
- ag
13886

139-
volumes:
140-
bundle:
87+
virtuoso-ut:
88+
image: openlink/virtuoso-opensource-7:7.2.16
89+
environment:
90+
- SPARQL_UPDATE=true
91+
- DBA_PASSWORD=dba
92+
- DAV_PASSWORD=dba
93+
ports:
94+
- 1111:1111
95+
- 8890:8890
96+
volumes:
97+
- ./test/fixtures/backends/virtuoso_initdb_d:/initdb.d
98+
healthcheck:
99+
test: [ "CMD-SHELL", "echo 'status();' | isql localhost:1111 dba dba || exit 1" ]
100+
start_period: 10s
101+
interval: 10s
102+
timeout: 5s
103+
retries: 3
104+
profiles:
105+
- vo
106+
107+
graphdb-ut:
108+
image: ontotext/graphdb:10.8.12
109+
environment:
110+
GDB_HEAP_SIZE: 5G
111+
GDB_JAVA_OPTS: >-
112+
-Xms5g -Xmx5g
113+
ports:
114+
- 7200:7200
115+
- 7300:7300
116+
healthcheck:
117+
test: [ "CMD", "curl", "-sf", "http://localhost:7200/repositories/ontoportal_test/health" ]
118+
start_period: 10s
119+
interval: 10s
120+
volumes:
121+
- ./test/fixtures/backends/graphdb:/opt/graphdb/dist/configs/templates/data
122+
entrypoint: >
123+
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
124+
; graphdb -Ddefault.min.distinct.threshold=3000 "
125+
profiles:
126+
- gd
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
2+
@prefix rep: <http://www.openrdf.org/config/repository#> .
3+
@prefix sail: <http://www.openrdf.org/config/sail#> .
4+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5+
6+
<#ontoportal_test> a rep:Repository;
7+
rep:repositoryID "ontoportal_test";
8+
rep:repositoryImpl [
9+
rep:repositoryType "graphdb:SailRepository";
10+
<http://www.openrdf.org/config/repository/sail#sailImpl> [
11+
<http://www.ontotext.com/trree/owlim#base-URL> "http://example.org/owlim#";
12+
<http://www.ontotext.com/trree/owlim#check-for-inconsistencies> "false";
13+
<http://www.ontotext.com/trree/owlim#defaultNS> "";
14+
<http://www.ontotext.com/trree/owlim#disable-sameAs> "true";
15+
<http://www.ontotext.com/trree/owlim#enable-context-index> "false";
16+
<http://www.ontotext.com/trree/owlim#enable-literal-index> "true";
17+
<http://www.ontotext.com/trree/owlim#enablePredicateList> "true";
18+
<http://www.ontotext.com/trree/owlim#entity-id-size> "32";
19+
<http://www.ontotext.com/trree/owlim#entity-index-size> "10000000";
20+
<http://www.ontotext.com/trree/owlim#imports> "";
21+
<http://www.ontotext.com/trree/owlim#in-memory-literal-properties> "true";
22+
<http://www.ontotext.com/trree/owlim#owlim-license> "";
23+
<http://www.ontotext.com/trree/owlim#query-limit-results> "0";
24+
<http://www.ontotext.com/trree/owlim#query-timeout> "0";
25+
<http://www.ontotext.com/trree/owlim#read-only> "false";
26+
<http://www.ontotext.com/trree/owlim#repository-type> "file-repository";
27+
<http://www.ontotext.com/trree/owlim#ruleset> "rdfsplus-optimized";
28+
<http://www.ontotext.com/trree/owlim#storage-folder> "storage";
29+
<http://www.ontotext.com/trree/owlim#throw-QueryEvaluationException-on-timeout> "false";
30+
sail:sailType "owlim:Sail"
31+
]
32+
];
33+
rdfs:label "" .

test/fixtures/backends/graphdb/graphdb-test-load.nt

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GRANT EXECUTE ON DB.DBA.SPARQL_INSERT_DICT_CONTENT TO "SPARQL";
2+
GRANT SPARQL_UPDATE TO "SPARQL";
3+
DB.DBA.RDF_DEFAULT_USER_PERMS_SET ('nobody', 7);

0 commit comments

Comments
 (0)