Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Jan 12, 2024
2 parents 657149d + db2b330 commit 75436fe
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 283 deletions.
32 changes: 14 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
base64 (0.2.0)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
cube-ruby (0.0.3)
daemons (1.4.1)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
domain_name (0.6.20240107)
eventmachine (1.2.7)
faraday (2.7.11)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
Expand All @@ -53,13 +52,13 @@ GEM
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json_pure (2.6.3)
json_pure (2.7.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
method_source (1.0.0)
mime-types (3.5.1)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.1003)
mime-types-data (3.2023.1205)
minitest (4.7.5)
multi_json (1.15.0)
mustermann (3.0.0)
Expand All @@ -69,20 +68,21 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.3)
public_suffix (5.0.4)
rack (2.2.8)
rack-accept (0.4.5)
rack (>= 0.4)
rack-post-body-to-params (0.1.8)
activesupport (>= 2.3)
rack-protection (3.1.0)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rake (13.1.0)
rdf (1.0.8)
addressable (>= 2.2)
redis (5.0.8)
redis-client (>= 0.17.0)
redis-client (0.18.0)
redis-client (0.19.1)
connection_pool
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand All @@ -103,10 +103,10 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (3.1.0)
sinatra (3.2.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
rack-protection (= 3.2.0)
tilt (~> 2.0)
systemu (2.6.5)
thin (1.8.2)
Expand All @@ -116,15 +116,11 @@ GEM
thread_safe (0.3.6)
tilt (2.3.0)
tzinfo (0.3.62)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
uuid (2.3.9)
macaddr (~> 1.0)

PLATFORMS
ruby
x86_64-darwin-16
x86_64-linux

DEPENDENCIES
Expand All @@ -144,4 +140,4 @@ DEPENDENCIES
uuid

BUNDLED WITH
2.3.15
2.3.22
8 changes: 3 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ services:
retries: 5

agraph-ut:
#image: franzinc/agraph:v7.3.1
image: ontoportal/agraph:v7.3.1-patch1
image: franzinc/agraph:v8.0.0
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
- AGRAPH_SUPER_PASSWORD=xyzzy
shm_size: 1g
ports:
# - 10035:10035
- 10000-10035:10000-10035
volumes:
- agdata:/agraph/data
Expand All @@ -41,8 +39,8 @@ services:
; 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
# test: ["CMD-SHELL", "curl -m 1 -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1"]
# start_period: 60s
# interval: 10s
# timeout: 5s
# retries: 5
Expand Down
28 changes: 18 additions & 10 deletions rakelib/docker_based_test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
desc 'Run unit tests with docker based backend'
namespace :test do
namespace :docker do
desc "clean docker images and volumes"

task :clean do
system("docker compose down --volumes")
end
task :up do
system("docker compose up -d") || abort("Unable to start docker containers")
end
Expand All @@ -19,19 +24,22 @@ namespace :test do
ENV["GOO_PATH_UPDATE"]="/repositories/ontoportal_test/statements"
ENV["COMPOSE_PROFILES"]="ag"
Rake::Task["test:docker:up"].invoke

# AG takes some time to start and create databases/accounts
# TODO: replace system curl command with native ruby code
unless system("curl -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1")
printf("waiting for AllegroGraph container to initialize")
sec = 0
until system("curl -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1") do
sleep(1)
printf(".")
sec += 1
abort(" AllegroGraph container hasn't initialized properly") if sec > 30
end
printf("waiting for AllegroGraph container to initialize")
sec = 0
until system("curl -m 3 -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1")
sleep(1)
printf(".")
sec += 1
next unless sec > 60

puts
Rake::Task["test:docker:down"].invoke
abort("\nAborted; can't initialise AllegroGraph container")
end
puts
puts
system("docker compose ps") # TODO: remove after GH actions troubleshooting is complete
Rake::Task["test"].invoke
Rake::Task["test:docker:down"].invoke
Expand Down
45 changes: 23 additions & 22 deletions test/test_chunks_write.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ def test_reentrant_queries
sleep(1.5)
count_queries = 0
tq = Thread.new {
5.times do
oq = "SELECT (count(?s) as ?c) WHERE { ?s a ?o }"
Goo.sparql_query_client.query(oq).each do |sol|
assert sol[:c].object > 0
end
count_queries += 1
end
5.times do
oq = "SELECT (count(?s) as ?c) WHERE { ?s a ?o }"
Goo.sparql_query_client.query(oq).each do |sol|
assert_operator 0, :<, sol[:c].object
end
count_queries += 1
end
}
tq.join
assert tput.alive?
assert_predicate tput, :alive?
assert_equal 5, count_queries
tput.join

Expand All @@ -110,13 +110,13 @@ def test_reentrant_queries
sleep(1.5)
count_queries = 0
tq = Thread.new {
5.times do
oq = "SELECT (count(?s) as ?c) WHERE { ?s a ?o }"
Goo.sparql_query_client.query(oq).each do |sol|
assert sol[:c].object > 0
end
count_queries += 1
end
5.times do
oq = "SELECT (count(?s) as ?c) WHERE { ?s a ?o }"
Goo.sparql_query_client.query(oq).each do |sol|
assert_operator 0, :<, sol[:c].object
end
count_queries += 1
end
}
tq.join
assert tdelete.alive?
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_query_flood
50.times do |j|
oq = "SELECT (count(?s) as ?c) WHERE { ?s a ?o }"
Goo.sparql_query_client.query(oq).each do |sol|
assert sol[:c].object > 0
assert_operator 0, :<, sol[:c].object
end
end
}
Expand All @@ -158,13 +158,15 @@ def test_query_flood
sleep(1.2)
end
}
end

threads.each do |t|
t.join
end
tput.join
threads.each do |t|
t.join
end
tput.join

assert log_status.map { |x| x[:outstanding] }.max > 0
if Goo.sparql_backend_name.downcase == BACKEND_4STORE
assert_operator 0, :<, log_status.map { |x| x[:outstanding] }.max
assert_equal 16, log_status.map { |x| x[:running] }.max
end
end
Expand All @@ -182,6 +184,5 @@ def self.params_for_backend(method, graph_name, ntriples_file_path = nil)
end
params
end

end
end
Loading

0 comments on commit 75436fe

Please sign in to comment.