Add CI test pipeline, split unit/integration tests, and enforce tests in release workflows#10
Conversation
|
@jwfing, please have a look on this pr when you get a chance. Since this PR is from a fork, GitHub Actions may require maintainer approval to run workflows. Could you approve and trigger the checks? Thanks! |
|
Great job! Since we need to run integration tests in workflow, I think it's necessary to make TestConfig.kt configurable, for example, read BASE_URL/ANON_KEY from env vars. |
|
While implementing "remove -x test", and testing locally I discovered that the Napier dependency (2.7.1) was compiled with JDK 17 (class file version 61.0). Tests crash with UnsupportedClassVersionError on JDK 11 — the old -x test flag was masking this. I've bumped all workflows to JDK 17 so tests can actually run. The build.gradle.kts still targets JDK 11 for source/target compatibility, so the published artifact is unchanged. @jwfing could you confirm you're okay with the JDK 17 bump in the CI and publish workflows? |
…ump JDK to 17 - TestConfig now reads INSFORGE_BASE_URL, INSFORGE_ANON_KEY, and INSFORGE_TEST_JWT_TOKEN from environment variables, falling back to hardcoded defaults for local development. - ApiResponseTest and CaptureApiResponsesTest now use TestConfig instead of duplicating credentials. - ci.yml gains a dedicated integration-tests job that injects secrets via env vars. - All workflows bumped from JDK 11 to 17 because the Napier dependency (2.7.1) requires class file version 61 (JDK 17).
|
@jwfing TestConfig is now env-var configurable. TestConfig.kt reads INSFORGE_BASE_URL, INSFORGE_ANON_KEY, and INSFORGE_TEST_JWT_TOKEN from environment variables, falling back to the existing hardcoded defaults for local development. I also updated ApiResponseTest and CaptureApiResponsesTest to use TestConfig instead of duplicating credentials. Local test results (JDK 17, local Docker backend):
|
|
Except of RealtimeLowLevelAPI, there are still 6 tests failed: Can you fix them? By the way, for JWT token, maybe we can generate it via auth#login with specified credentials(email + password), instead of passing by env. @junaiddshaukat |
|
@jwfing I addressed your feedback: Fixed 6 failing tests (excluding RealtimeLowLevelAPI):
Updated ci.yml env vars accordingly (INSFORGE_TEST_EMAIL, INSFORGE_TEST_PASSWORD). Local test results (Docker backend, no S3 configured): Unit tests: 6/6 passed
|
| - name: Run integration tests | ||
| run: ./gradlew integrationTest | ||
| env: | ||
| INSFORGE_BASE_URL: ${{ secrets.INSFORGE_BASE_URL }} |
There was a problem hiding this comment.
It is indeed the case that secrets are unavailable for PRs originating from forks. Consequently, the current job still executes, passing empty strings to the integration tests.
Could you modify the workflow to first check for the presence of secrets; if they are missing, the integration tests will be skipped entirely to prevent fork PRs from failing due to missing configuration.
There was a problem hiding this comment.
working on it
There was a problem hiding this comment.
Fixed now, please have a look



Summary
This PR implements a proper CI test pipeline and separating unit tests from integration tests.
What Changed
main.github/workflows/ci.yml./gradlew build testtesttask excludesintegrationintegrationTesttask includesintegration@Tag("integration")across integration test classes.github/workflows/publish.yml.github/workflows/publish-maven-central.yml-x testand ensured build/tests run before publish./gradlew test(unit tests)./gradlew integrationTest(integration tests)Validation
./gradlew clean build test./gradlew integrationTest --dry-runtask wiring verifiedintegrationTestcurrently has environment-related failures (e.g., realtime token expiry / backend service availability), not introduced by this PR.Issue
Fixes #2