From b1e2ce8ca23cad5ee3fbe3472500ca93b548f09a Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 11:35:40 -0800 Subject: [PATCH 1/8] integrate ontoportal_testkit --- .github/workflows/ruby-unit-test.yml | 42 --- .github/workflows/testkit-unit-tests.yml | 62 +++++ .ontoportal-testkit.yml | 8 + .ruby-version | 1 + Dockerfile | 22 +- Gemfile | 1 + Gemfile.lock | 18 +- docker-compose.yml | 125 --------- rakelib/docker_based_test.rake | 240 ------------------ rakelib/ontoportal_testkit.rake | 2 + .../backends/graphdb/graphdb-repo-config.ttl | 33 --- .../backends/graphdb/graphdb-test-load.nt | 0 .../virtuoso-grant-write-sparql-access.sql | 3 - 13 files changed, 91 insertions(+), 466 deletions(-) delete mode 100644 .github/workflows/ruby-unit-test.yml create mode 100644 .github/workflows/testkit-unit-tests.yml create mode 100644 .ontoportal-testkit.yml create mode 100644 .ruby-version delete mode 100644 docker-compose.yml delete mode 100644 rakelib/docker_based_test.rake create mode 100644 rakelib/ontoportal_testkit.rake delete mode 100644 test/fixtures/backends/graphdb/graphdb-repo-config.ttl delete mode 100644 test/fixtures/backends/graphdb/graphdb-test-load.nt delete mode 100644 test/fixtures/backends/virtuoso_initdb_d/virtuoso-grant-write-sparql-access.sql diff --git a/.github/workflows/ruby-unit-test.yml b/.github/workflows/ruby-unit-test.yml deleted file mode 100644 index 85233f9c..00000000 --- a/.github/workflows/ruby-unit-test.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Ruby Unit Test - -on: - push: - branches: - - '**' - tags-ignore: - - '**' # ignore all tag pushes - pull_request: - -permissions: - contents: read - -jobs: - test: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - goo-slice: [ '100'] - ruby-version: [ '3.2' ] - triplestore: [ 'fs', 'ag', 'vo', 'gd' ] - - steps: - - uses: actions/checkout@v4 - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get -y install raptor2-utils - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Add config file - # tempoaray workaround for the config.rb file requirement - run: echo 'Goo.config do |config| end' > config/config.rb - - name: List directory contents - run: ls -R ./test/fixtures - - name: Run tests - run: GOO_SLICES=${{ matrix.goo-slice }} bundle exec rake test:docker:${{ matrix.triplestore }} TESTOPTS="-v" - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 diff --git a/.github/workflows/testkit-unit-tests.yml b/.github/workflows/testkit-unit-tests.yml new file mode 100644 index 00000000..89e3f541 --- /dev/null +++ b/.github/workflows/testkit-unit-tests.yml @@ -0,0 +1,62 @@ +name: Docker Unit Tests + +on: + push: + branches: + - '**' + tags-ignore: + - '**' + pull_request: + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + backends: ${{ steps.cfg.outputs.backends }} + steps: + - uses: actions/checkout@v4 + + - id: cfg + name: Read backend matrix from .ontoportal-testkit.yml + run: | + BACKENDS=$(ruby -ryaml -rjson -e 'c=YAML.safe_load_file(".ontoportal-testkit.yml") || {}; b=c["backends"] || %w[fs ag vo gd]; puts JSON.generate(b)') + echo "backends=$BACKENDS" >> "$GITHUB_OUTPUT" + + test: + needs: prepare + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + backend: ${{ fromJson(needs.prepare.outputs.backends) }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby from .ruby-version + uses: ruby/setup-ruby@v1 + with: + ruby-version: .ruby-version + + - name: Checkout ontoportal_testkit + uses: actions/checkout@v4 + with: + repository: alexskr/ontoportal_testkit + path: .tooling/ontoportal_testkit + + - name: Run unit tests in linux container + env: + CI: "true" + TESTOPTS: "-v" + BACKEND: ${{ matrix.backend }} + run: | + ruby -I .tooling/ontoportal_testkit/lib -e 'require "rake"; require "ontoportal/testkit/tasks"; Rake::Task["test:docker:#{ENV.fetch("BACKEND")}:linux"].invoke' + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests,${{ matrix.backend }} + verbose: true + fail_ci_if_error: false diff --git a/.ontoportal-testkit.yml b/.ontoportal-testkit.yml new file mode 100644 index 00000000..26c89c78 --- /dev/null +++ b/.ontoportal-testkit.yml @@ -0,0 +1,8 @@ +component_name: goo +app_service: test-linux +backends: + - fs + - ag + - vo + - gd +dependency_services: [] diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..e650c01d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.9 diff --git a/Dockerfile b/Dockerfile index 1dd2150b..6c566230 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,18 @@ ARG RUBY_VERSION=3.2 ARG DISTRO=bullseye - -FROM ruby:$RUBY_VERSION-$DISTRO - -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - git \ - libxml2 \ - libxslt-dev \ - libxslt1-dev zlib1g-dev \ - # openjdk-11-jre-headless \ - raptor2-utils \ - && rm -rf /var/lib/apt/lists/* +ARG TESTKIT_BASE_IMAGE=ontoportal/testkit-base:ruby${RUBY_VERSION}-${DISTRO} +FROM ${TESTKIT_BASE_IMAGE} WORKDIR /app COPY Gemfile* *.gemspec ./ -#Install the exact Bundler version from Gemfile.lock (if it exists) -RUN gem update --system && \ - if [ -f Gemfile.lock ]; then \ +# Respect the project's Bundler lock when present. +RUN if [ -f Gemfile.lock ]; then \ BUNDLER_VERSION=$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d ' '); \ gem install bundler -v "$BUNDLER_VERSION"; \ - else \ - gem install bundler; \ fi -RUN bundle config set --global no-document 'true' RUN bundle install --jobs 4 --retry 3 COPY . ./ diff --git a/Gemfile b/Gemfile index 31a4b42a..c1163f02 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ group :test do gem "pry" gem 'simplecov' gem 'simplecov-cobertura' # for submitting code coverage results to codecov.io + gem 'ontoportal_testkit', github: 'alexskr/ontoportal_testkit', branch: 'main' end group :profiling do diff --git a/Gemfile.lock b/Gemfile.lock index 2817e9ba..3867966a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: https://github.com/alexskr/ontoportal_testkit.git + revision: 76ce5236a74d816a6df0f8e59d762a5dc7d686d6 + branch: main + specs: + ontoportal_testkit (0.1.0) + rake (>= 13.0) + GIT remote: https://github.com/ncbo/sparql-client.git revision: 2ac20b217bb7ad2b11305befe0ee77d75e44eac5 @@ -105,7 +113,7 @@ GEM rack-protection (3.2.0) base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) - rake (13.2.1) + rake (13.3.1) rdf (3.3.2) bcp47_spec (~> 0.2) bigdecimal (~> 3.1, >= 3.1.5) @@ -161,20 +169,20 @@ GEM date timeout (0.4.3) tzinfo (0.3.62) - uri (1.0.2) + uri (1.1.1) uuid (2.3.9) macaddr (~> 1.0) PLATFORMS - arm64-darwin-23 - arm64-darwin-24 - x86_64-linux + arm64-darwin + x86_64-linux-gnu DEPENDENCIES activesupport goo! minitest (< 5.0) net-ftp + ontoportal_testkit! pry rack-accept rack-post-body-to-params diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 2b1ae3b0..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,125 +0,0 @@ -# unit tests in containerased env -services: - test-linux: - build: - context: . - args: - RUBY_VERSION: '3.2' - command: ["bash", "-lc", "bundle exec rake test"] - environment: - COVERAGE: 'true' # enable simplecov code coverage - REDIS_HOST: redis-ut - SEARCH_SERVER_URL: http://solr-ut:8983/solr - depends_on: - solr-ut: - condition: service_healthy - redis-ut: - condition: service_healthy - profiles: - - linux - - redis-ut: - image: redis - ports: - - 6379:6379 - command: ["redis-server", "--save", "", "--appendonly", "no"] - healthcheck: - test: redis-cli ping - interval: 10s - timeout: 3s - retries: 10 - - solr-ut: - image: solr:9 - command: bin/solr start -cloud -f - ports: - - 8983:8983 - healthcheck: - test: ["CMD", "curl", "-sf", "http://localhost:8983/solr/admin/info/system?wt=json"] - start_period: 5s - interval: 10s - timeout: 5s - retries: 5 - - 4store-ut: - image: bde2020/4store - platform: linux/amd64 - ports: - - 9000:9000 - command: > - bash -c "4s-backend-setup --segments 4 ontoportal_test - && 4s-backend ontoportal_test - && 4s-httpd -D -s-1 -p 9000 ontoportal_test" - healthcheck: - test: ["CMD", "4s-backend-info", "ontoportal_test"] - start_period: 5s - interval: 10s - timeout: 10s - retries: 5 - profiles: - - fs - - agraph-ut: - image: franzinc/agraph:v8.4.3 - platform: linux/amd64 #agraph doesn't provide arm platform - environment: - - AGRAPH_SUPER_USER=test - - AGRAPH_SUPER_PASSWORD=xyzzy - shm_size: 1g - ports: - - 10035:10035 - command: > - bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start - ; agtool repos create --supersede ontoportal_test - ; agtool users add anonymous - ; agtool users grant anonymous root:ontoportal_test:rw - ; tail -f /agraph/data/agraph.log" - healthcheck: - test: ["CMD", "agtool", "storage-report", "ontoportal_test"] - start_period: 30s #AllegroGraph can take a loooooong time to start - interval: 20s - timeout: 10s - retries: 20 - profiles: - - ag - - virtuoso-ut: - image: openlink/virtuoso-opensource-7:7.2.16 - environment: - - SPARQL_UPDATE=true - - DBA_PASSWORD=dba - - DAV_PASSWORD=dba - ports: - - 1111:1111 - - 8890:8890 - volumes: - - ./test/fixtures/backends/virtuoso_initdb_d:/initdb.d - healthcheck: - test: [ "CMD-SHELL", "echo 'status();' | isql localhost:1111 dba dba || exit 1" ] - start_period: 10s - interval: 10s - timeout: 5s - retries: 3 - profiles: - - vo - - graphdb-ut: - image: ontotext/graphdb:10.8.12 - environment: - GDB_HEAP_SIZE: 5G - GDB_JAVA_OPTS: >- - -Xms5g -Xmx5g - ports: - - 7200:7200 - - 7300:7300 - healthcheck: - test: [ "CMD", "curl", "-sf", "http://localhost:7200/repositories/ontoportal_test/health" ] - start_period: 10s - interval: 10s - volumes: - - ./test/fixtures/backends/graphdb:/opt/graphdb/dist/configs/templates/data - entrypoint: > - 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 - ; graphdb -Ddefault.min.distinct.threshold=3000 " - profiles: - - gd diff --git a/rakelib/docker_based_test.rake b/rakelib/docker_based_test.rake deleted file mode 100644 index c3cd32aa..00000000 --- a/rakelib/docker_based_test.rake +++ /dev/null @@ -1,240 +0,0 @@ -# Docker compose driven unit test orchestration -# -# Notes: -# - Backend names match compose profile names (ag, fs, vo, gd). -# - Hostnames are NOT set here. The app defaults them (localhost for host runs). -# - Linux container env is provided via compose override files: -# dev/compose/linux/ag.yml -# dev/compose/linux/fs.yml -# dev/compose/linux/vo.yml -# dev/compose/linux/gd.yml -namespace :test do - namespace :docker do - BASE_COMPOSE = 'docker-compose.yml' - LINUX_OVERRIDE_DIR = 'dev/compose/linux' - LINUX_NO_PORTS_OVERRIDE = "#{LINUX_OVERRIDE_DIR}/no-ports.yml" - TIMEOUT = (ENV['OP_TEST_DOCKER_TIMEOUT'] || '600').to_i - DEFAULT_BACKEND = (ENV['OP_TEST_DOCKER_BACKEND'] || 'fs').to_sym - - # Minimal per-backend config for host runs only. - # Do not set hostnames here. The app defaults them. - BACKENDS = { - ag: { - host_env: { - 'GOO_BACKEND_NAME' => 'allegrograph', - 'GOO_PORT' => '10035', - 'GOO_PATH_QUERY' => '/repositories/ontoportal_test', - 'GOO_PATH_DATA' => '/repositories/ontoportal_test/statements', - 'GOO_PATH_UPDATE' => '/repositories/ontoportal_test/statements' - } - }, - fs: { - host_env: { - 'GOO_BACKEND_NAME' => '4store', - 'GOO_PORT' => '9000', - 'GOO_PATH_QUERY' => '/sparql/', - 'GOO_PATH_DATA' => '/data/', - 'GOO_PATH_UPDATE' => '/update/' - } - }, - vo: { - host_env: { - 'GOO_BACKEND_NAME' => 'virtuoso', - 'GOO_PORT' => '8890', - 'GOO_PATH_QUERY' => '/sparql', - 'GOO_PATH_DATA' => '/sparql', - 'GOO_PATH_UPDATE' => '/sparql' - } - }, - gd: { - host_env: { - 'GOO_BACKEND_NAME' => 'graphdb', - 'GOO_PORT' => '7200', - 'GOO_PATH_QUERY' => '/repositories/ontoportal_test', - 'GOO_PATH_DATA' => '/repositories/ontoportal_test/statements', - 'GOO_PATH_UPDATE' => '/repositories/ontoportal_test/statements' - } - } - }.freeze - - def abort_with(msg) - warn(msg) - exit(1) - end - - def shell!(cmd) - system(cmd) || abort_with("Command failed: #{cmd}") - end - - def cfg!(key) - cfg = BACKENDS[key] - abort_with("Unknown backend key: #{key}. Supported: #{BACKENDS.keys.join(', ')}") unless cfg - cfg - end - - def compose_files(*files) - files.flatten.map { |f| "-f #{f}" }.join(' ') - end - - def linux_override_for(key) - "#{LINUX_OVERRIDE_DIR}/#{key}.yml" - end - - def compose_up(key, files:) - # Host tests use only the backend profile. Linux tests add the linux profile. - # `docker compose up --wait` only applies to services started by `up`, - # so linux runs still call `run` separately after this wait completes. - shell!("docker compose #{compose_files(files)} --profile #{key} up -d --wait --wait-timeout #{TIMEOUT}") - end - - def compose_down(files:) - return puts('OP_KEEP_CONTAINERS=1 set, skipping docker compose down') if ENV['OP_KEEP_CONTAINERS'] == '1' - - shell!( - "docker compose #{compose_files(files)} " \ - '--profile ag --profile fs --profile vo --profile gd --profile linux down' - ) - end - - def apply_host_env(key) - cfg!(key)[:host_env].each { |k, v| ENV[k] = v } - end - - def run_host_tests(key) - apply_host_env(key) - files = [BASE_COMPOSE] - - compose_up(key, files: files) - Rake::Task['test'].invoke - end - - def run_linux_tests(key) - override = linux_override_for(key) - abort_with("Missing compose override file: #{override}") unless File.exist?(override) - abort_with("Missing compose override file: #{LINUX_NO_PORTS_OVERRIDE}") unless File.exist?(LINUX_NO_PORTS_OVERRIDE) - - files = [BASE_COMPOSE, override, LINUX_NO_PORTS_OVERRIDE] - # docker compose is handleling wait_for_healthy - compose_up(key, files: files) - - shell!( - "docker compose #{compose_files(files)} --profile linux --profile #{key} " \ - 'run --rm --build test-linux bundle exec rake test TESTOPTS="-v"' - ) - end - - def run_linux_shell(key) - override = linux_override_for(key) - abort_with("Missing compose override file: #{override}") unless File.exist?(override) - abort_with("Missing compose override file: #{LINUX_NO_PORTS_OVERRIDE}") unless File.exist?(LINUX_NO_PORTS_OVERRIDE) - - files = [BASE_COMPOSE, override, LINUX_NO_PORTS_OVERRIDE] - compose_up(key, files: files) - - shell!( - "docker compose #{compose_files(files)} --profile linux --profile #{key} " \ - 'run --rm --build test-linux bash' - ) - end - - # - # Public tasks - # - - desc 'Run unit tests with AllegroGraph backend (docker deps, host Ruby)' - task :ag do - run_host_tests(:ag) - ensure - Rake::Task['test'].reenable - compose_down(files: [BASE_COMPOSE]) - end - - desc 'Run unit tests with AllegroGraph backend (docker deps, Linux container)' - task 'ag:linux' do - files = [BASE_COMPOSE, linux_override_for(:ag)] - begin - run_linux_tests(:ag) - ensure - compose_down(files: files) - end - end - - desc 'Run unit tests with 4store backend (docker deps, host Ruby)' - task :fs do - run_host_tests(:fs) - ensure - Rake::Task['test'].reenable - compose_down(files: [BASE_COMPOSE]) - end - - desc 'Run unit tests with 4store backend (docker deps, Linux container)' - task 'fs:linux' do - files = [BASE_COMPOSE, linux_override_for(:fs)] - begin - run_linux_tests(:fs) - ensure - compose_down(files: files) - end - end - - desc 'Run unit tests with Virtuoso backend (docker deps, host Ruby)' - task :vo do - run_host_tests(:vo) - ensure - Rake::Task['test'].reenable - compose_down(files: [BASE_COMPOSE]) - end - - desc 'Run unit tests with Virtuoso backend (docker deps, Linux container)' - task 'vo:linux' do - files = [BASE_COMPOSE, linux_override_for(:vo)] - begin - run_linux_tests(:vo) - ensure - compose_down(files: files) - end - end - - desc 'Run unit tests with GraphDB backend (docker deps, host Ruby)' - task :gd do - run_host_tests(:gd) - ensure - Rake::Task['test'].reenable - compose_down(files: [BASE_COMPOSE]) - end - - desc 'Run unit tests with GraphDB backend (docker deps, Linux container)' - task 'gd:linux' do - files = [BASE_COMPOSE, linux_override_for(:gd)] - begin - run_linux_tests(:gd) - ensure - compose_down(files: files) - end - end - - desc 'Start a shell in the Linux test container (default backend: fs)' - task :shell, [:backend] do |_t, args| - key = (args[:backend] || DEFAULT_BACKEND).to_sym - cfg!(key) - files = [BASE_COMPOSE, linux_override_for(key), LINUX_NO_PORTS_OVERRIDE] - begin - run_linux_shell(key) - ensure - compose_down(files: files) - end - end - - desc 'Start backend services for development (default backend: fs)' - task :up, [:backend] do |_t, args| - key = (args[:backend] || DEFAULT_BACKEND).to_sym - cfg!(key) - compose_up(key, files: [BASE_COMPOSE]) - end - - desc 'Stop backend services for development (default backend: fs)' - task :down, [:backend] do |_t, args| - compose_down(files: [BASE_COMPOSE]) - end - end -end diff --git a/rakelib/ontoportal_testkit.rake b/rakelib/ontoportal_testkit.rake new file mode 100644 index 00000000..7f04305c --- /dev/null +++ b/rakelib/ontoportal_testkit.rake @@ -0,0 +1,2 @@ +# Loads shared OntoPortal testkit rake tasks into this component. +require "ontoportal/testkit/tasks" diff --git a/test/fixtures/backends/graphdb/graphdb-repo-config.ttl b/test/fixtures/backends/graphdb/graphdb-repo-config.ttl deleted file mode 100644 index 84032a0b..00000000 --- a/test/fixtures/backends/graphdb/graphdb-repo-config.ttl +++ /dev/null @@ -1,33 +0,0 @@ -@prefix rdfs: . -@prefix rep: . -@prefix sail: . -@prefix xsd: . - -<#ontoportal_test> a rep:Repository; - rep:repositoryID "ontoportal_test"; - rep:repositoryImpl [ - rep:repositoryType "graphdb:SailRepository"; - [ - "http://example.org/owlim#"; - "false"; - ""; - "true"; - "false"; - "true"; - "true"; - "32"; - "10000000"; - ""; - "true"; - ""; - "0"; - "0"; - "false"; - "file-repository"; - "rdfsplus-optimized"; - "storage"; - "false"; - sail:sailType "owlim:Sail" - ] - ]; - rdfs:label "" . diff --git a/test/fixtures/backends/graphdb/graphdb-test-load.nt b/test/fixtures/backends/graphdb/graphdb-test-load.nt deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/backends/virtuoso_initdb_d/virtuoso-grant-write-sparql-access.sql b/test/fixtures/backends/virtuoso_initdb_d/virtuoso-grant-write-sparql-access.sql deleted file mode 100644 index d509c6fb..00000000 --- a/test/fixtures/backends/virtuoso_initdb_d/virtuoso-grant-write-sparql-access.sql +++ /dev/null @@ -1,3 +0,0 @@ -GRANT EXECUTE ON DB.DBA.SPARQL_INSERT_DICT_CONTENT TO "SPARQL"; -GRANT SPARQL_UPDATE TO "SPARQL"; -DB.DBA.RDF_DEFAULT_USER_PERMS_SET ('nobody', 7); From a36b4aebfa7afdf0bc906d4175240e3d4881b52c Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 11:48:40 -0800 Subject: [PATCH 2/8] add default config file for tests --- config/config.test.rb | 2 ++ test/test_case.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 config/config.test.rb diff --git a/config/config.test.rb b/config/config.test.rb new file mode 100644 index 00000000..972ad2da --- /dev/null +++ b/config/config.test.rb @@ -0,0 +1,2 @@ +Goo.config do |config| +end diff --git a/test/test_case.rb b/test/test_case.rb index 22fd77bc..a8eda0ab 100644 --- a/test/test_case.rb +++ b/test/test_case.rb @@ -20,7 +20,7 @@ MiniTest::Unit.autorun require_relative "../lib/goo.rb" -require_relative '../config/config' +require_relative '../config/config.test' # Safety guard for destructive tests: ensure test targets are safe (localhost or -ut suffix) module TestSafety From 8781f818bf2cb8817d7f74375d2380b931f9f628 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 11:58:33 -0800 Subject: [PATCH 3/8] gem update --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3867966a..80185178 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/alexskr/ontoportal_testkit.git - revision: 76ce5236a74d816a6df0f8e59d762a5dc7d686d6 + revision: 5bb8a188465e266a75f06cf63b96ccb2d03be3d1 branch: main specs: ontoportal_testkit (0.1.0) From 9261b0f488619ac89cff37628e6aed8835411ea5 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 21:51:23 -0800 Subject: [PATCH 4/8] update testkit --- .github/workflows/testkit-unit-tests.yml | 21 +++++++++++++++++++-- .ontoportal-testkit.yml | 2 +- Gemfile | 4 ---- Gemfile.lock | 2 +- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testkit-unit-tests.yml b/.github/workflows/testkit-unit-tests.yml index 89e3f541..0e4c8186 100644 --- a/.github/workflows/testkit-unit-tests.yml +++ b/.github/workflows/testkit-unit-tests.yml @@ -8,6 +8,14 @@ on: - '**' pull_request: +env: + # CI execution mode for backend tests: + # - container: run `test:docker::container` (default) + # - native: run `test:docker:` on host Ruby + # OPTK_CI_RUN_MODE: { vars.OPTK_CI_RUN_MODE || 'container' }} + # Example override to force native mode in this workflow file: + OPTK_CI_RUN_MODE: native + jobs: prepare: runs-on: ubuntu-latest @@ -45,13 +53,22 @@ jobs: repository: alexskr/ontoportal_testkit path: .tooling/ontoportal_testkit - - name: Run unit tests in linux container + - name: Run unit tests env: CI: "true" TESTOPTS: "-v" BACKEND: ${{ matrix.backend }} run: | - ruby -I .tooling/ontoportal_testkit/lib -e 'require "rake"; require "ontoportal/testkit/tasks"; Rake::Task["test:docker:#{ENV.fetch("BACKEND")}:linux"].invoke' + MODE="${OPTK_CI_RUN_MODE:-container}" + TASK="test:docker:${BACKEND}" + if [ "$MODE" = "container" ]; then + TASK="${TASK}:container" + elif [ "$MODE" != "native" ]; then + echo "Invalid OPTK_CI_RUN_MODE=$MODE (expected container or native)" + exit 1 + fi + + TASK="$TASK" ruby -I .tooling/ontoportal_testkit/lib -e 'require "rake"; require "ontoportal/testkit/tasks"; Rake::Task[ENV.fetch("TASK")].invoke' - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 diff --git a/.ontoportal-testkit.yml b/.ontoportal-testkit.yml index 26c89c78..75588b98 100644 --- a/.ontoportal-testkit.yml +++ b/.ontoportal-testkit.yml @@ -1,5 +1,5 @@ component_name: goo -app_service: test-linux +app_service: test-container backends: - fs - ag diff --git a/Gemfile b/Gemfile index c1163f02..e7ee86c9 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,3 @@ end gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'ontoportal-lirmm-development' gem "rdf-raptor", github: "ruby-rdf/rdf-raptor", ref: "6392ceabf71c3233b0f7f0172f662bd4a22cd534" # use version 3.3.0 when available gem 'net-ftp' - -# # to remove if no more supporting ruby 2.7 -# gem 'faraday', '2.7.11' #unpin if we no more support ruby 2.7 -# gem 'public_suffix', '~> 5.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 80185178..ad28d96b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/alexskr/ontoportal_testkit.git - revision: 5bb8a188465e266a75f06cf63b96ccb2d03be3d1 + revision: 98c0c1c4a89ebbb6106cd7bbc6cd1409b3ed3c7e branch: main specs: ontoportal_testkit (0.1.0) From aca5aca5da49a6ab78cee7170c3842f7f6588cee Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 23:11:09 -0800 Subject: [PATCH 5/8] update testkit --- .github/workflows/testkit-unit-tests.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testkit-unit-tests.yml b/.github/workflows/testkit-unit-tests.yml index 0e4c8186..8cc57772 100644 --- a/.github/workflows/testkit-unit-tests.yml +++ b/.github/workflows/testkit-unit-tests.yml @@ -12,9 +12,9 @@ env: # CI execution mode for backend tests: # - container: run `test:docker::container` (default) # - native: run `test:docker:` on host Ruby - # OPTK_CI_RUN_MODE: { vars.OPTK_CI_RUN_MODE || 'container' }} + OPTK_CI_RUN_MODE: ${{ vars.OPTK_CI_RUN_MODE || 'container' }} # Example override to force native mode in this workflow file: - OPTK_CI_RUN_MODE: native + # OPTK_CI_RUN_MODE: native jobs: prepare: @@ -46,12 +46,7 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: .ruby-version - - - name: Checkout ontoportal_testkit - uses: actions/checkout@v4 - with: - repository: alexskr/ontoportal_testkit - path: .tooling/ontoportal_testkit + bundler-cache: true - name: Run unit tests env: @@ -68,7 +63,7 @@ jobs: exit 1 fi - TASK="$TASK" ruby -I .tooling/ontoportal_testkit/lib -e 'require "rake"; require "ontoportal/testkit/tasks"; Rake::Task[ENV.fetch("TASK")].invoke' + bundle exec rake "$TASK" - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 From bc54dbd171926778fb5e89029b239996cfab2d1c Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 23:15:57 -0800 Subject: [PATCH 6/8] run unit tests natively --- .github/workflows/testkit-unit-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testkit-unit-tests.yml b/.github/workflows/testkit-unit-tests.yml index 8cc57772..3d75ad2e 100644 --- a/.github/workflows/testkit-unit-tests.yml +++ b/.github/workflows/testkit-unit-tests.yml @@ -12,9 +12,9 @@ env: # CI execution mode for backend tests: # - container: run `test:docker::container` (default) # - native: run `test:docker:` on host Ruby - OPTK_CI_RUN_MODE: ${{ vars.OPTK_CI_RUN_MODE || 'container' }} + # OPTK_CI_RUN_MODE: ${{ vars.OPTK_CI_RUN_MODE || 'container' }} # Example override to force native mode in this workflow file: - # OPTK_CI_RUN_MODE: native + OPTK_CI_RUN_MODE: native jobs: prepare: From bd58b9e75b47410d3833afac0ebcbf0f7742bb49 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 23:25:36 -0800 Subject: [PATCH 7/8] update testkit --- .github/workflows/testkit-unit-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/testkit-unit-tests.yml b/.github/workflows/testkit-unit-tests.yml index 3d75ad2e..b23760fc 100644 --- a/.github/workflows/testkit-unit-tests.yml +++ b/.github/workflows/testkit-unit-tests.yml @@ -42,6 +42,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install native system dependencies + if: env.OPTK_CI_RUN_MODE == 'native' + run: | + sudo apt-get update + sudo apt-get install -y raptor2-utils + - name: Set up Ruby from .ruby-version uses: ruby/setup-ruby@v1 with: From 28e87a27fd70977b7c1cf2823c2e65b6072ef427 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 27 Feb 2026 23:43:09 -0800 Subject: [PATCH 8/8] Gemfile.lock update --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ad28d96b..3a135890 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/alexskr/ontoportal_testkit.git - revision: 98c0c1c4a89ebbb6106cd7bbc6cd1409b3ed3c7e + revision: c154c17f2e8b1a7931b710febfcadb15e566f672 branch: main specs: ontoportal_testkit (0.1.0)