Skip to content

Commit

Permalink
chore: parameterize integration tests
Browse files Browse the repository at this point in the history
refactors integration tests to execute identically across runtimes

with this change, we can also specify tests to run with the integration-test script (e.g. `integration-tests TestLifecycle` — all tests are fully encapsulated and can execute alone). providing no option will run all tests.

tests have been split into the following:

- TestLifecycle (init, deploy, call)
- TestHttpIngress (tests all http methods and tests aliased fields)
- TestDatabase
- TestExternalCalls (kotlin -> go call, kotlin -> kotlin call, etc. for all runtime permutations)

a couple small changes captured by the integration tests are also included in this PR:
- Database.kt converts module name and DB name to uppercase to align with the Go DB SDK
- Kotlin schema extractor includes module names for all DataRef schema objects, even those declared in the referencing module (this fixes builtin.HttpRequest/Response types for HTTP ingress in Kotlin)
  • Loading branch information
worstell committed Jan 31, 2024
1 parent bab131b commit 2f63162
Show file tree
Hide file tree
Showing 13 changed files with 580 additions and 113 deletions.
48 changes: 45 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,47 @@ concurrency:
cancel-in-progress: true
name: Integration
jobs:
upload-jars:
name: Build JARs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Build JARs
run: just install-jars
- name: Archive JARs
uses: actions/upload-artifact@v2
with:
name: jars
path: ~/.m2/repository/xyz/block/
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-tests.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Extract test cases
id: extract-tests
run: |
echo "cases=$(go test -v -list . ./integration | grep '^Test' | awk '{print $1}' | cut -d '(' -f1 | tr '\n' ',' | sed 's/,$//')" >> "$GITHUB_OUTPUT"
- name: Format test matrix
id: set-tests
run: |
IFS=',' read -ra TESTS <<< "${{ steps.extract-tests.outputs.cases }}"
TEST_JSON=$(printf ',"%s"' "${TESTS[@]}")
TEST_JSON="[${TEST_JSON:1}]"
echo "matrix={\"test\": $TEST_JSON}" >> "$GITHUB_OUTPUT"
integration:
name: Integration tests
needs: [prepare,upload-jars]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -20,5 +58,9 @@ jobs:
run: docker compose up -d --wait
- name: Download Go Modules
run: go mod download
- name: Integration tests
run: go test -v -tags integration ./integration
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: jars
- name: Run ${{ matrix.test }}
run: go test -v -tags integration -run ${{ matrix.test }} ./integration
Loading

0 comments on commit 2f63162

Please sign in to comment.