Repository navigation
[#13962] improvement(test): Add test service providers, with external MySQL and PostgreSQL - #16
Draft
nevzheng wants to merge 1 commit into
Conversation
…ternal MySQL and PostgreSQL Proof of concept for the SPIP in design-docs/testing/containers/. Tests ask ContainerSuite.getService(ServiceSpec) for a service and get a ServiceEndpoint. ContainerSuite asks ServiceProviders in order and keeps the first answer: providers listed through ServiceLoader, then ExternalServiceProvider (gravitino.test.<service>.* properties), then ContainerServiceProvider (today's containers). MySQL and PostgreSQL are the first services: DatabaseEndpoint is implemented by DatabaseContainer and by ExternalDatabase. The core MySQL and PostgreSQL lanes pass GRAVITINO_TEST_<MYSQL|POSTGRESQL>_URL, _USER and _PASSWORD to the test JVM; with them set, the lane starts no container and needs no Docker. Database names on an external server carry a random per-JVM token, and a run drops only what it created. BaseIT, BackendTestExtension, AbstractEntityStorageTest and the partition statistics tests take the login from the endpoint instead of root/root. A new core-test-external-db CI job runs both lanes against GitHub Actions service containers and checks that no other container started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Nevin · project thread
Proof of concept for the SPIP PR it is stacked on. Supersedes apache#13838.
What changes were proposed in this pull request?
integration-test-common:ServiceEndpoint,ServiceSpec<E>,ServiceProvider, andContainerSuite.getService(spec), which asks providers in order and keeps the first answer:ServiceLoaderplug-ins, thenExternalServiceProvider(gravitino.test.<service>.*properties), thenContainerServiceProvider(today's containers).DatabaseEndpoint, implemented byDatabaseContainerand by the newExternalDatabase. On an external server, database names carry a random per-JVM token, and a run drops only what it created.coreMySQLTest/corePostgreSQLTestpassGRAVITINO_TEST_<MYSQL|POSTGRESQL>_URL,_USERand_PASSWORDto the test JVM; with them set, the lane starts no container and needs no Docker.BaseIT,BackendTestExtension,AbstractEntityStorageTestand the partition statistics tests take the login from the endpoint instead ofroot/root.core-test-external-dbruns both lanes against GitHub Actions service containers and checks that no other container started.Why are the changes needed?
Tests can only get services by starting containers, so they cannot run where Docker is unavailable or services are already provided, such as Kubernetes services.
Fix: apache#13962
Does this PR introduce any user-facing change?
No. Tests only; without the variables, behaviour is unchanged.
How was this patch tested?
TestServiceResolverandTestExternalDatabase(10 tests)../gradlew :core:coreMySQLTest :core:corePostgreSQLTest -PskipDockerTests=trueagainst local MySQL 8.0 and PostgreSQL 16 servers with the variables set: 594 tests each, 0 failures, no databases left behind,[TEST-SERVICE-SOURCE] ... provider=externallogged.core-testjobs cover it.Generated by Claude Code