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 d6a0c26
Show file tree
Hide file tree
Showing 13 changed files with 561 additions and 115 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: Set up Go
uses: actions/setup-go@v2
- name: Extract test cases
id: extract-tests
run: |
echo "::set-output name=cases::$(go test -v -list . ./integration | grep '^Test' | awk '{print $1}' | cut -d '(' -f1 | tr '\n' ',' | sed 's/,$//')"
- 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 "::set-output name=matrix::{\"test\": $TEST_JSON}"
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 -run ^${{ matrix.test }}$ -v ./integration
Loading

0 comments on commit d6a0c26

Please sign in to comment.