Skip to content

Commit

Permalink
chore: parameterize integration tests (#840)
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 aliased fields and all http methods )
- 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 authored Jan 31, 2024
1 parent d6204e2 commit ae379aa
Show file tree
Hide file tree
Showing 13 changed files with 561 additions and 113 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,32 @@ concurrency:
cancel-in-progress: true
name: Integration
jobs:
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 . -tags integration ./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
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 +43,5 @@ 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: Run ${{ matrix.test }}
run: go test -v -tags integration -run ${{ matrix.test }} ./integration
Loading

0 comments on commit ae379aa

Please sign in to comment.