Repository navigation
Add support for connection url for data plane operations only - #19
Conversation
austin-denoble
left a comment
There was a problem hiding this comment.
Looks good to me, I think @jhamon's point around improving some of the validation of needed fields at the time of calling connect() would be ideal.
I'm also curious if it makes sense to add / update any of the existing /java/pineconeexamples/* files to demonstrate the added functionality, but maybe that's not necessary quite yet.
Yes, my plan is to have those examples updated and we have a follow up ticket. Thanks for pointing out. |
… concurrently (#19) * ci: build once in pr.yml, cancel superseded runs, cap job time - The build job's three Gradle steps (clean build, a no-op jar, compileIntegrationTestJava) become one `./gradlew build compileIntegrationTestJava`. - The integration-test job no longer runs a redundant `clean build`; it runs only `./gradlew integrationTest`, which compiles what it needs. - The cleanup job builds only `shadowJar` (3.7 s) instead of a clean build (14.7 s, measured locally). - Every call uses the committed wrapper (pinned to Gradle 8.5), so the per-matrix gradle-version inputs are gone and the matrix is a plain list. - A top-level concurrency group cancels a PR's older run on a new push. Pushes to main and manual dispatches get one group per run. A cancelled run still runs its always() cleanup, which deletes only that run's resources. - timeout-minutes on every job: build 20, integration-test 45, cleanup 15. Verified: offline build green (97 unit tests); actionlint and a YAML parse pass. The workflow has not run in CI yet. * test: keep the cause in AssertRetry and skip the sleep after the last try AssertRetry threw a new AssertionError holding only the last message, which dropped the stack trace of the real failure. It also slept after the final attempt for no reason. It now rethrows with the last failure as the cause and returns as soon as an attempt passes. The class moves from src/integration to src/test (integration code still sees it through test.output) so four new keyless unit tests cover success, eventual success, exhaustion with cause, and no trailing sleep. Verified: offline build green, unit tests +4. * ci: upload test reports on failure, summarize counts, preflight the key - When a test job fails, pr.yml uploads build/reports/tests and build/test-results as an artifact named for the job and JDK. - Each Gradle Test task appends its passed/failed/skipped counts to $GITHUB_STEP_SUMMARY, so the run page shows them without opening logs. - Jobs that need PINECONE_API_KEY fail in a first step with one clear error when the secret is empty, instead of a cascade of test failures. Verified: actionlint and a YAML parse pass; offline build green. Not yet exercised in CI. * test: log integration tests at INFO with timestamps and show stderr src/test/resources sets slf4j-simple to trace, and that file is also on the integration classpath, so live runs either flooded the log or showed nothing useful. integrationTest now sets slf4j-simple to INFO with HH:mm:ss.SSS timestamps through system properties, and adds STANDARD_ERROR to the test logging events so client and fixture logs reach the CI output. TestResourcesManager logs under its own logger name (it used TestUtilities.class) and logs each index and collection it creates. Verified: live ListEndpointTest on a disposable project printed timestamped INFO lines (24 lines in total, no TRACE/DEBUG); offline build green. * test: poll for fixture readiness instead of sleeping Adds Poll.until(condition, timeout, interval, probe, done[, retryable]), which fails with an AssertionError naming the condition and the last value or error. PollTest has 5 keyless unit tests. - waitUntilIndexIsReady polls through Poll. It drops its 20 s sleep after Ready and now fails on timeout instead of logging a warning and continuing. - TestResourcesManager drops its two 30 s post-Ready sleeps. seedIndex retries the first upsert on gRPC UNAVAILABLE ("no healthy upstream") for up to 120 s, then polls describeIndexStats until the seeded namespace shows the expected count. The old loop (`count == 0 || waited <= 60 s`) always waited more than 60 s and never ended while the count stayed 0. - waitUntilCollectionIsReady replaces two copies of a collection wait whose timeout check could never fire. Verified live on a disposable project: ListEndpointTest 189 s -> 8 s; serverless indexes Ready about 2.5 s after create, pod about 17 s; seeded vectors visible within 225 ms; 0 UNAVAILABLE retries needed in 4 fixture creations; no leftover indexes. Offline build green, unit tests +5. * test: create pod and serverless fixtures concurrently Every getOrCreate* method in TestResourcesManager synchronized on the singleton, so the pod fixture waited for serverless seeding to finish. The class now uses one lock per resource (pod, serverless, collection). collectionLock may take podLock, never the reverse. Verified live (UpsertAndQueryPodTest + UpsertAndQueryServerlessTest): the two fixtures were created 11 ms apart instead of one after the other; wall-clock 30.5 s -> 21.7 s; 4/4 passed. Offline build green. * test: run pod-index tests only on opt-in Pod indexes count against a per-project pod quota (20 for the CI project). Several PR runs at once exhaust it and fail with 403 "You've reached the max pods allowed in project". The 7 classes that create or use a pod index are now @tag("pod"), and integrationTest excludes that tag unless Gradle gets -PincludePodTests=true. The nightly full suite passes the flag; PR CI needs no workflow change. The shared pod fixture in TestResourcesManager is created lazily, and only pod-tagged classes ask for it. Tagged: pod/CollectionTest, pod/ConfigureIndexTest, pod/CreateDescribeListAndDeleteIndexTest, pod/DeletionProtectionTest, UpdateFetchAndQueryPodTest, UpsertAndQueryPodTest, UpsertDescribeIndexStatsAndDeletePodTest. Verified: offline build green (97 unit tests). Live on a disposable project: default integrationTest 72/72 in 248 s, 0 pod classes run, pod count unchanged at its pre-existing 6. With -PincludePodTests=true --tests '*UpsertAndQueryPodTest': 4/4, pod count 6 -> 7 -> 6.
Problem
Connection url contains indexName, environment, and projectName but currently these values are manually set by the users in configuration, so the use the connection url string instead of asking for 3 different variables for data plane operations only.
Solution
To reduce user errors, parse the connection url string to get indexName, environment, and projectName and add them to the configurations. The grpc calls for data plane were using these variables for reconstructing the endpoint again so added an if-else loop where if a valid connection url is found, it'll be used instead of reconstructing the endpoint. Although, if no connection url is passed, it'll be constructing the endpoint using the three variables mentioned before which is done as of today.
Type of Change
Test Plan
Created unit tests and performed manual integration tests locally.