-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENHC0010012B] Workflow executions: End to end integration test (#621)
* github actions sapporo * fix exclude keyword * remove coverage from sapporo test * Fix normal tests * Store ga4gh wes server endpoint in config to allow test servers * have main test runner skip sapporo integration * simplify wes api endpoint inti * add tmp/storage/ to clean_dev script
- Loading branch information
1 parent
66a777c
commit f8563c3
Showing
7 changed files
with
180 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Sapporo CI | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:14.6 | ||
env: | ||
POSTGRES_DB: irida_next_test | ||
POSTGRES_PASSWORD: test | ||
POSTGRES_USER: test | ||
POSTGRES_HOST: postgres | ||
ports: | ||
- 5432:5432 | ||
# Set health checks to wait until postgres has started | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Set up PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
- name: Use Node.js 19 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 19 | ||
cache: "pnpm" | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Install Sapporo dependencies | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: adopt | ||
java-version: 16 | ||
- name: Download Sapporo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: phac-nml/sapporo-service | ||
ref: irida-next | ||
path: ./sapporo | ||
- name: Build Sapporo | ||
run: | | ||
cd sapporo | ||
IRIDA_NEXT_PATH=${GITHUB_WORKSPACE}/tmp MYUID="$(id -u)" MYGID="$(id -g)" docker compose -f compose.irida-next.yml up -d --build | ||
cd .. | ||
- name: Run Sapporo | ||
uses: JarvusInnovations/background-action@v1 | ||
with: | ||
run: | | ||
IRIDA_NEXT_PATH=${GITHUB_WORKSPACE}/tmp MYUID="$(id -u)" MYGID="$(id -g)" docker compose -f compose.irida-next.yml exec app bash -c "sapporo" | ||
wait-on: | ||
http://localhost:1122/service-info | ||
wait-for: 2m | ||
working-directory: sapporo | ||
- name: Update permissions | ||
run: sudo chmod -R 777 ${GITHUB_WORKSPACE} | ||
- name: Run tests | ||
run: | | ||
bin/rails test test/integration/sapporo.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'active_job_test_case' | ||
|
||
class IntegrationSapporoTest < ActiveJobTestCase | ||
def setup | ||
@workflow_execution = workflow_executions(:irida_next_example_end_to_end) | ||
Rails.configuration.ga4gh_wes_server_endpoint = 'http://localhost:1122/' | ||
end | ||
|
||
def teardown | ||
Rails.configuration.ga4gh_wes_server_endpoint = nil | ||
end | ||
|
||
test 'integration sapporo end to end' do | ||
# Before starting test, check if Sapporo Integration is running. | ||
begin | ||
ga4gh_client = Integrations::Ga4ghWesApi::V1::Client.new | ||
ga4gh_client.service_info | ||
rescue Integrations::ApiExceptions::ConnectionError | ||
skip 'Sapporo server is not running' | ||
end | ||
|
||
assert_equal 'initial', @workflow_execution.state | ||
assert_not @workflow_execution.cleaned? | ||
|
||
WorkflowExecutionPreparationJob.perform_later(@workflow_execution) | ||
|
||
perform_enqueued_jobs_sequentially(except: WorkflowExecutionSubmissionJob) | ||
assert_equal 'prepared', @workflow_execution.reload.state | ||
|
||
perform_enqueued_jobs_sequentially(except: WorkflowExecutionStatusJob) | ||
assert_equal 'submitted', @workflow_execution.reload.state | ||
|
||
perform_enqueued_jobs_sequentially(delay_seconds: 10, except: WorkflowExecutionCompletionJob) | ||
assert_equal 'completing', @workflow_execution.reload.state | ||
|
||
perform_enqueued_jobs_sequentially(except: WorkflowExecutionCleanupJob) | ||
assert_equal 'completed', @workflow_execution.reload.state | ||
|
||
perform_enqueued_jobs_sequentially | ||
|
||
assert_equal 'completed', @workflow_execution.reload.state | ||
assert @workflow_execution.cleaned? | ||
end | ||
end |