From 1550d0c9fed09df7c3577829c2bb3c94a0555bc2 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 10:41:24 -0400 Subject: [PATCH 01/14] WIP on spec updates --- .../actions/test-control-plane/action.yaml | 53 +++++++++++ .github/actions/test-data-plane/action.yaml | 5 - .github/workflows/optimistic-updates.yaml | 93 +++++++++++++++++++ 3 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 .github/actions/test-control-plane/action.yaml create mode 100644 .github/workflows/optimistic-updates.yaml diff --git a/.github/actions/test-control-plane/action.yaml b/.github/actions/test-control-plane/action.yaml new file mode 100644 index 000000000..518bdbfb0 --- /dev/null +++ b/.github/actions/test-control-plane/action.yaml @@ -0,0 +1,53 @@ +name: 'Test Control Plane' +description: 'Runs tests on the Pinecone control plane' + +inputs: + test_suite: + description: 'The type of the index (serverless, pod)' + required: true + default: 'serverless' + python_version: + description: 'The version of Python to use' + required: false + default: '3.9' + metric: + description: 'The metric of the index' + required: true + spec: + description: 'The deploy spec of the index' + required: true + use_grpc: + description: 'Whether to use gRPC or REST' + required: true + freshness_timeout_seconds: + description: 'The number of seconds to wait for the index to become fresh' + required: false + default: '60' + PINECONE_API_KEY: + description: 'The Pinecone API key' + required: true + +runs: + using: 'composite' + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python_version }} + + - name: Setup Poetry + uses: ./.github/actions/setup-poetry + with: + include_grpc: ${{ inputs.use_grpc }} + include_dev: 'true' + + - name: Run tests + id: data-plane-tests + shell: bash + run: poetry run pytest tests/integration/control/${{ inputs.test_suite }} + env: + PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} + USE_GRPC: ${{ inputs.use_grpc }} + METRIC: ${{ inputs.metric }} + SPEC: ${{ inputs.spec }} + FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }} \ No newline at end of file diff --git a/.github/actions/test-data-plane/action.yaml b/.github/actions/test-data-plane/action.yaml index 9fafc0d50..847d234df 100644 --- a/.github/actions/test-data-plane/action.yaml +++ b/.github/actions/test-data-plane/action.yaml @@ -30,11 +30,6 @@ inputs: required: false default: '3.9' -outputs: - index_name: - description: 'The name of the index, including randomized suffix' - value: ${{ steps.create-index.outputs.index_name }} - runs: using: 'composite' steps: diff --git a/.github/workflows/optimistic-updates.yaml b/.github/workflows/optimistic-updates.yaml new file mode 100644 index 000000000..3e52142e9 --- /dev/null +++ b/.github/workflows/optimistic-updates.yaml @@ -0,0 +1,93 @@ +name: Update Spec + +on: + workflow_dispatch: {} +# schedule: +# - cron: '0 0 * * *' + +jobs: + update-and-build: + name: Build docs with pdoc + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up git + run: | + git config --global user.name "Pinecone CI" + git config --global user.email "clients@pinecone.io" + + - name: Update spec + run: | + ./scripts/build-oas.sh + git add codegen + git add pinecone/core + + - name: Commit changes + id: commit + run: + if git diff --cached --quiet; then + echo "No changes are staged." + echo "new_changes=true" >> "$GITHUB_OUTPUT" + else + echo "There are staged changes." + git commit -m'Regenerate core with latest specs' + echo "new_changes=false" >> "$GITHUB_OUTPUT" + fi + + - name: Abort if no recent changes + if: steps.commit.outputs.new_changes == 'false' + uses: andymckay/cancel-action@0.3 + + - name: Test data plane (rest) + uses: ./.github/actions/test-data-plane + with: + metric: 'cosine' + use_grpc: false + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 + + - name: Test control plane (serverless, rest) + uses: ./.github/actions/test-control-plane + with: + test_suite: 'serverless' + use_grpc: false + metric: 'cosine' + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 + + - name: Test control plane (serverless, grpc) + uses: ./.github/actions/test-control-plane + with: + test_suite: 'serverless' + use_grpc: true + metric: 'cosine' + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 + + - name: Test control plane (pod, rest) + uses: ./.github/actions/test-control-plane + with: + test_suite: 'pod' + use_grpc: false + metric: 'cosine' + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 + + - name: Test control plane (pod, grpc) + uses: ./.github/actions/test-control-plane + with: + test_suite: 'pod' + use_grpc: true + metric: 'cosine' + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 + + - name: Push changes + run: git push \ No newline at end of file From 3194fbb4a149be7bf32779526b4d59430260bada Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 13:08:44 -0400 Subject: [PATCH 02/14] Refactoring tests --- .../actions/test-control-plane/action.yaml | 3 +- .github/workflows/testing-integration.yaml | 94 +++++-------------- tests/integration/control/pod/conftest.py | 22 +++-- .../control/serverless/conftest.py | 36 +++---- 4 files changed, 57 insertions(+), 98 deletions(-) diff --git a/.github/actions/test-control-plane/action.yaml b/.github/actions/test-control-plane/action.yaml index 518bdbfb0..37cd8025a 100644 --- a/.github/actions/test-control-plane/action.yaml +++ b/.github/actions/test-control-plane/action.yaml @@ -50,4 +50,5 @@ runs: USE_GRPC: ${{ inputs.use_grpc }} METRIC: ${{ inputs.metric }} SPEC: ${{ inputs.spec }} - FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }} \ No newline at end of file + FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }} + GITHUB_BUILD_NUMBER: '${{ github.run_number }}-p-${{ matrix.testConfig.python-version}}' \ No newline at end of file diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index 6a4bbdb18..c93531c34 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -68,88 +68,44 @@ jobs: # spec: '${{ matrix.spec }}' # PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' - control-rest-pod: - name: control plane pod/collection tests + control-plane-pod: + name: control plane pod runs-on: ubuntu-latest strategy: matrix: - pineconeEnv: - - prod - testConfig: - - python-version: 3.8 - pod: { environment: 'us-east1-gcp'} - - python-version: 3.12 - pod: { environment: 'us-east4-gcp'} + python-version: [3.8, 3.9, 3.10, 3.11] + use_grpc: [true, false] fail-fast: false steps: - uses: actions/checkout@v4 - - name: 'Set up Python ${{ matrix.testConfig.python-version }}' - uses: actions/setup-python@v5 + - name: Test control plane (pod, rest) + uses: ./.github/actions/test-control-plane with: - python-version: '${{ matrix.testConfig.python-version }}' - - name: Setup Poetry - uses: ./.github/actions/setup-poetry - - name: 'Run integration tests (REST, prod)' - if: matrix.pineconeEnv == 'prod' - run: poetry run pytest tests/integration/control/pod -s -v - env: - PINECONE_DEBUG_CURL: 'true' - PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' - PINECONE_ENVIRONMENT: '${{ matrix.testConfig.pod.environment }}' - GITHUB_BUILD_NUMBER: '${{ github.run_number }}-s-${{ matrix.testConfig.python-version}}' - DIMENSION: 2500 - METRIC: 'cosine' - - name: 'Run integration tests (REST, staging)' - if: matrix.pineconeEnv == 'staging' - run: poetry run pytest tests/integration/control/pod -s -v - env: - PINECONE_DEBUG_CURL: 'true' - PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io' - PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY_STAGING }}' - PINECONE_ENVIRONMENT: '${{ matrix.testConfig.pod.environment }}' - GITHUB_BUILD_NUMBER: '${{ github.run_number }}-p-${{ matrix.testConfig.python-version}}' - DIMENSION: 1536 - METRIC: 'cosine' + python_version: '${{ matrix.python-version }}' + test_suite: 'pod' + use_grpc: ${{ matrix.use_grpc }} + metric: 'cosine' + spec: '{ "pod": { "environment": "us-east4-gcp", "pod_type": "p1.x1" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 - control-rest-serverless: + control-plane-serverless: name: control plane serverless runs-on: ubuntu-latest strategy: matrix: - pineconeEnv: - - prod - testConfig: - - python-version: 3.8 # Do one test run with 3.8 for sanity check - pod: { environment: 'us-east1-gcp'} - serverless: { cloud: 'aws', region: 'us-west-2'} - - python-version: 3.12 - pod: { environment: 'us-east1-gcp'} - serverless: { cloud: 'aws', region: 'us-west-2'} + python-version: [3.8, 3.9, 3.10, 3.11] + use_grpc: [true, false] fail-fast: false steps: - uses: actions/checkout@v4 - - name: 'Set up Python ${{ matrix.testConfig.python-version }}' - uses: actions/setup-python@v5 + - name: Test control plane (serverless, rest) + uses: ./.github/actions/test-control-plane with: - python-version: '${{ matrix.testConfig.python-version }}' - - name: Setup Poetry - uses: ./.github/actions/setup-poetry - - name: 'Run integration tests (REST, prod)' - if: matrix.pineconeEnv == 'prod' - run: poetry run pytest tests/integration/control/serverless -s -vv - env: - PINECONE_DEBUG_CURL: 'true' - PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' - GITHUB_BUILD_NUMBER: '${{ github.run_number }}-p-${{ matrix.testConfig.python-version}}' - SERVERLESS_CLOUD: '${{ matrix.testConfig.serverless.cloud }}' - SERVERLESS_REGION: '${{ matrix.testConfig.serverless.region }}' - - name: 'Run integration tests (REST, staging)' - if: matrix.pineconeEnv == 'staging' - run: poetry run pytest tests/integration/control/serverless -s -vv - env: - PINECONE_DEBUG_CURL: 'true' - PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io' - PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY_STAGING }}' - GITHUB_BUILD_NUMBER: '${{ github.run_number }}-s-${{ matrix.testConfig.python-version}}' - SERVERLESS_CLOUD: '${{ matrix.testConfig.serverless.cloud }}' - SERVERLESS_REGION: '${{ matrix.testConfig.serverless.region }}' + python_version: '${{ matrix.python-version }}' + test_suite: 'serverless' + use_grpc: ${{ matrix.use_grpc }} + metric: 'cosine' + spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + freshness_timeout_seconds: 600 \ No newline at end of file diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index 35f6613fd..74345be55 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -2,19 +2,30 @@ import random import string import time +import json from pinecone import Pinecone, PodSpec from ...helpers import generate_index_name, get_environment_var @pytest.fixture() -def client(): +def use_grpc(): + return get_environment_var("USE_GRPC") == "true" + + +@pytest.fixture() +def client(use_grpc): api_key = get_environment_var("PINECONE_API_KEY") - return Pinecone(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) + if use_grpc: + from pinecone.grpc import PineconeGRPC + + return PineconeGRPC(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) + else: + return Pinecone(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) @pytest.fixture() -def environment(): - return get_environment_var("PINECONE_ENVIRONMENT") +def spec(): + return json.loads(get_environment_var("SPEC")) @pytest.fixture() @@ -23,8 +34,7 @@ def dimension(): @pytest.fixture() -def create_index_params(index_name, environment, dimension, metric): - spec = {"pod": {"environment": environment, "pod_type": "p1.x1"}} +def create_index_params(index_name, spec, dimension, metric): return dict(name=index_name, dimension=dimension, metric=metric, spec=spec, timeout=-1) diff --git a/tests/integration/control/serverless/conftest.py b/tests/integration/control/serverless/conftest.py index 1a6ee0ba1..b6d3ed2a8 100644 --- a/tests/integration/control/serverless/conftest.py +++ b/tests/integration/control/serverless/conftest.py @@ -2,29 +2,34 @@ import pytest import random import time +import json from pinecone import Pinecone, NotFoundException, PineconeApiException from ...helpers import generate_index_name, get_environment_var @pytest.fixture() -def client(): - api_key = get_environment_var("PINECONE_API_KEY") - return Pinecone(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) +def use_grpc(): + return get_environment_var("USE_GRPC", "false") == "true" @pytest.fixture() -def serverless_cloud(): - return get_environment_var("SERVERLESS_CLOUD", "aws") +def client(use_grpc): + api_key = get_environment_var("PINECONE_API_KEY") + if use_grpc: + from pinecone.grpc import PineconeGRPC + + return PineconeGRPC(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) + else: + return Pinecone(api_key=api_key, additional_headers={"sdk-test-suite": "pinecone-python-client"}) @pytest.fixture() -def serverless_region(): - return get_environment_var("SERVERLESS_REGION", "us-west-2") +def spec(): + return json.loads(get_environment_var("SPEC")) @pytest.fixture() -def create_sl_index_params(index_name, serverless_cloud, serverless_region): - spec = {"serverless": {"cloud": serverless_cloud, "region": serverless_region}} +def create_sl_index_params(index_name, spec): return dict(name=index_name, dimension=10, metric="cosine", spec=spec) @@ -53,19 +58,6 @@ def notready_sl_index(client, index_name, create_sl_index_params): yield index_name -@pytest.fixture() -def ready_pod_index(client, index_name, create_pod_index_params): - del create_pod_index_params["timeout"] - client.create_index(**create_pod_index_params) - yield index_name - - -@pytest.fixture() -def notready_pod_index(client, index_name, create_pod_index_params): - client.create_index(**create_pod_index_params) - yield index_name - - def delete_with_retry(client, index_name, retries=0, sleep_interval=5): print("Deleting index " + index_name + ", retry " + str(retries) + ", next sleep interval " + str(sleep_interval)) try: From e59ebdd7524a117293cbeb2a76deafd672f48b9c Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 13:10:25 -0400 Subject: [PATCH 03/14] Refactoring tests --- .github/workflows/testing-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index c93531c34..2dc4d96b6 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -73,7 +73,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: ['3.8', '3.9', '3.10', '3.11'] use_grpc: [true, false] fail-fast: false steps: From 4e651e633303885c401f47ad92c30f878c3b4c7e Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 13:13:42 -0400 Subject: [PATCH 04/14] Refactoring tests --- .github/actions/test-control-plane/action.yaml | 4 ++++ .github/workflows/testing-integration.yaml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/actions/test-control-plane/action.yaml b/.github/actions/test-control-plane/action.yaml index 37cd8025a..8382e5318 100644 --- a/.github/actions/test-control-plane/action.yaml +++ b/.github/actions/test-control-plane/action.yaml @@ -13,6 +13,9 @@ inputs: metric: description: 'The metric of the index' required: true + dimension: + description: 'The dimension of the index' + required: true spec: description: 'The deploy spec of the index' required: true @@ -49,6 +52,7 @@ runs: PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} USE_GRPC: ${{ inputs.use_grpc }} METRIC: ${{ inputs.metric }} + DIMENSION: ${{ inputs.dimension }} SPEC: ${{ inputs.spec }} FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }} GITHUB_BUILD_NUMBER: '${{ github.run_number }}-p-${{ matrix.testConfig.python-version}}' \ No newline at end of file diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index 2dc4d96b6..5455f86ea 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -85,6 +85,7 @@ jobs: test_suite: 'pod' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' + dimension: 1536 spec: '{ "pod": { "environment": "us-east4-gcp", "pod_type": "p1.x1" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 @@ -106,6 +107,7 @@ jobs: test_suite: 'serverless' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' + dimension: 1536 spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 \ No newline at end of file From 2961b060c1fd7e326177f29cb0ca6157326bf8fe Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 13:17:40 -0400 Subject: [PATCH 05/14] Refactoring tests --- tests/integration/control/pod/conftest.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index 74345be55..c2b559f92 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -82,7 +82,7 @@ def random_string(): @pytest.fixture(scope="session") -def reusable_collection(): +def reusable_collection(spec): pc = Pinecone( api_key=get_environment_var("PINECONE_API_KEY"), additional_headers={"sdk-test-suite": "pinecone-python-client"} ) @@ -93,9 +93,7 @@ def reusable_collection(): name=index_name, dimension=dimension, metric=get_environment_var("METRIC"), - spec=PodSpec( - environment=get_environment_var("PINECONE_ENVIRONMENT"), - ), + spec=spec, ) print(f"Created index {index_name}. Waiting 10 seconds to make sure it's ready...") time.sleep(10) From 7c1eca5097e218a94b1491107f3239679cb89ce5 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Thu, 25 Jul 2024 13:25:47 -0400 Subject: [PATCH 06/14] Let's' do this --- .github/workflows/testing-integration.yaml | 2 +- tests/integration/control/pod/conftest.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index 5455f86ea..a62f758a1 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -95,7 +95,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: ['3.8', '3.9', '3.10', '3.11'] use_grpc: [true, false] fail-fast: false steps: diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index c2b559f92..117db1d65 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -11,6 +11,9 @@ def use_grpc(): return get_environment_var("USE_GRPC") == "true" +@pytest.fixture() +def environment(spec): + return spec["pod"]["environment"] @pytest.fixture() def client(use_grpc): @@ -93,7 +96,7 @@ def reusable_collection(spec): name=index_name, dimension=dimension, metric=get_environment_var("METRIC"), - spec=spec, + spec=json.loads(get_environment_var("SPEC")), ) print(f"Created index {index_name}. Waiting 10 seconds to make sure it's ready...") time.sleep(10) From b87fd9b6df5bd02c9a5a76a56f0fe6987ae96067 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 09:52:56 -0400 Subject: [PATCH 07/14] Iterate on testing --- tests/integration/control/pod/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index 117db1d65..0c4677df6 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -85,7 +85,7 @@ def random_string(): @pytest.fixture(scope="session") -def reusable_collection(spec): +def reusable_collection(): pc = Pinecone( api_key=get_environment_var("PINECONE_API_KEY"), additional_headers={"sdk-test-suite": "pinecone-python-client"} ) From 164a1800d1b9ce12b5c08d9a076d9c6d00cc336c Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 09:56:48 -0400 Subject: [PATCH 08/14] Black formatting --- tests/integration/control/pod/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index 0c4677df6..8daf0aabf 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -11,10 +11,12 @@ def use_grpc(): return get_environment_var("USE_GRPC") == "true" + @pytest.fixture() def environment(spec): return spec["pod"]["environment"] + @pytest.fixture() def client(use_grpc): api_key = get_environment_var("PINECONE_API_KEY") From 98593fae310f268ea4da31f98244ee347d23f9bf Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 10:12:30 -0400 Subject: [PATCH 09/14] Extend wait times --- tests/integration/control/pod/conftest.py | 12 ++++++------ tests/integration/control/pod/test_collections.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/control/pod/conftest.py b/tests/integration/control/pod/conftest.py index 8daf0aabf..6835b6f02 100644 --- a/tests/integration/control/pod/conftest.py +++ b/tests/integration/control/pod/conftest.py @@ -115,15 +115,15 @@ def reusable_collection(): time_waited = 0 desc = pc.describe_collection(collection_name) collection_ready = desc["status"] - while collection_ready.lower() != "ready" and time_waited < 120: + while collection_ready.lower() != "ready" and time_waited < 300: print(f"Waiting for collection {collection_name} to be ready. Waited {time_waited} seconds...") time.sleep(5) time_waited += 5 desc = pc.describe_collection(collection_name) collection_ready = desc["status"] - if time_waited >= 120: - raise Exception(f"Collection {collection_name} is not ready after 120 seconds") + if time_waited >= 300: + raise Exception(f"Collection {collection_name} is not ready after 300 seconds") print(f"Collection {collection_name} is ready. Deleting index {index_name}...") pc.delete_index(index_name) @@ -139,7 +139,7 @@ def cleanup(client, index_name): yield time_waited = 0 - while index_exists(index_name, client) and time_waited < 120: + while index_exists(index_name, client) and time_waited < 300: print(f"Waiting for index {index_name} to be ready to delete. Waited {time_waited} seconds..") time_waited += 5 time.sleep(5) @@ -152,5 +152,5 @@ def cleanup(client, index_name): print(f"Unable to delete index {index_name}: {e}") pass - if time_waited >= 120: - raise Exception(f"Index {index_name} could not be deleted after 120 seconds") + if time_waited >= 300: + raise Exception(f"Index {index_name} could not be deleted after 300 seconds") diff --git a/tests/integration/control/pod/test_collections.py b/tests/integration/control/pod/test_collections.py index 10eb0499e..9e37f27e5 100644 --- a/tests/integration/control/pod/test_collections.py +++ b/tests/integration/control/pod/test_collections.py @@ -36,8 +36,8 @@ def test_index_to_collection_to_index_happy_path( assert collection_name in client.list_collections().names() - if time_waited >= 120: - raise Exception(f"Collection {collection_name} is not ready after 120 seconds") + if time_waited >= 5 * 60: + raise Exception(f"Collection {collection_name} is not ready after 5 minutes") # After collection ready, these should all be defined assert desc["name"] == collection_name @@ -96,5 +96,5 @@ def test_create_index_with_different_metric_from_orig_index( metric=target_metric, spec=PodSpec(environment=environment, source_collection=reusable_collection), ) - time.sleep(10) + time.sleep(30) client.delete_index(index_name, -1) From b4375c07902e09f122899acdbf05edf9e5e6b4ae Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 12:19:31 -0400 Subject: [PATCH 10/14] Extend wait times --- tests/integration/control/pod/test_collections.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/control/pod/test_collections.py b/tests/integration/control/pod/test_collections.py index 9e37f27e5..6d53222c8 100644 --- a/tests/integration/control/pod/test_collections.py +++ b/tests/integration/control/pod/test_collections.py @@ -26,8 +26,9 @@ def test_index_to_collection_to_index_happy_path( assert desc["status"] == "Initializing" time_waited = 0 + max_wait = 5 * 60 collection_ready = desc["status"] - while collection_ready.lower() != "ready" and time_waited < 120: + while collection_ready.lower() != "ready" and time_waited < max_wait: print(f"Waiting for collection {collection_name} to be ready. Waited {time_waited} seconds...") time.sleep(5) time_waited += 5 @@ -36,7 +37,7 @@ def test_index_to_collection_to_index_happy_path( assert collection_name in client.list_collections().names() - if time_waited >= 5 * 60: + if time_waited >= max_wait: raise Exception(f"Collection {collection_name} is not ready after 5 minutes") # After collection ready, these should all be defined From c14fc348cdb2349ccc0a01d33d289dffeecaee15 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 12:20:46 -0400 Subject: [PATCH 11/14] Reduce index dimension to cut down log output --- .github/workflows/testing-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index a62f758a1..6616072c2 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -85,7 +85,7 @@ jobs: test_suite: 'pod' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' - dimension: 1536 + dimension: 100 spec: '{ "pod": { "environment": "us-east4-gcp", "pod_type": "p1.x1" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 @@ -107,7 +107,7 @@ jobs: test_suite: 'serverless' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' - dimension: 1536 + dimension: 100 spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 \ No newline at end of file From 372a00d415e679605486c707cc59364b56f86859 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 12:38:42 -0400 Subject: [PATCH 12/14] Iterating --- .github/workflows/testing-integration.yaml | 4 ++-- tests/dependency/grpc/test_sanity.py | 2 +- tests/dependency/rest/test_sanity.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index 6616072c2..b9a13a354 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -85,7 +85,7 @@ jobs: test_suite: 'pod' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' - dimension: 100 + dimension: 10 spec: '{ "pod": { "environment": "us-east4-gcp", "pod_type": "p1.x1" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 @@ -107,7 +107,7 @@ jobs: test_suite: 'serverless' use_grpc: ${{ matrix.use_grpc }} metric: 'cosine' - dimension: 100 + dimension: 10 spec: '{ "serverless": { "cloud": "aws", "region": "us-west-2" }}' PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} freshness_timeout_seconds: 600 \ No newline at end of file diff --git a/tests/dependency/grpc/test_sanity.py b/tests/dependency/grpc/test_sanity.py index a7d8fb259..1d7c7afc3 100644 --- a/tests/dependency/grpc/test_sanity.py +++ b/tests/dependency/grpc/test_sanity.py @@ -31,7 +31,7 @@ def test_sanity(self, index_name, client): idx.upsert(vectors=[("1", [1.0, 2.0]), ("2", [3.0, 4.0]), ("3", [5.0, 6.0])]) # Wait for index freshness - time.sleep(30) + time.sleep(60) # Check the vector count reflects some data has been upserted description = idx.describe_index_stats() diff --git a/tests/dependency/rest/test_sanity.py b/tests/dependency/rest/test_sanity.py index 05ba5ed28..fd1bd82b0 100644 --- a/tests/dependency/rest/test_sanity.py +++ b/tests/dependency/rest/test_sanity.py @@ -31,7 +31,7 @@ def test_sanity(self, index_name, client): idx.upsert(vectors=[("1", [1.0, 2.0]), ("2", [3.0, 4.0]), ("3", [5.0, 6.0])]) # Wait for index freshness - time.sleep(30) + time.sleep(60) # Check the vector count reflects some data has been upserted description = idx.describe_index_stats() From 9e48274e7be86176b4f0fe5a4170b6ae5f45b4a6 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Fri, 26 Jul 2024 15:20:38 -0400 Subject: [PATCH 13/14] Trim test matrix --- .github/workflows/testing-integration.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index b9a13a354..6cddf1e64 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -73,7 +73,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + # python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.10'] use_grpc: [true, false] fail-fast: false steps: @@ -95,7 +96,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + # python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.10'] use_grpc: [true, false] fail-fast: false steps: From fa0474345f9cc72057a9803568e58afa1be52580 Mon Sep 17 00:00:00 2001 From: Jen Hamon Date: Tue, 30 Jul 2024 17:59:57 -0400 Subject: [PATCH 14/14] Adjusting config --- .github/workflows/testing-integration.yaml | 34 ++++------------------ 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/.github/workflows/testing-integration.yaml b/.github/workflows/testing-integration.yaml index 6cddf1e64..de63ab806 100644 --- a/.github/workflows/testing-integration.yaml +++ b/.github/workflows/testing-integration.yaml @@ -26,50 +26,26 @@ jobs: PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' data-plane-serverless: - name: Data plane serverless integration tests + name: data serverless runs-on: ubuntu-latest strategy: fail-fast: false matrix: python_version: [3.8, 3.12] use_grpc: [true, false] - metric: - - cosine - # - euclidean - # - dotproduct - spec: - - '{ "serverless": { "region": "us-west-2", "cloud": "aws" }}' steps: - uses: actions/checkout@v4 - uses: ./.github/actions/test-data-plane with: python_version: '${{ matrix.python_version }}' use_grpc: '${{ matrix.use_grpc }}' - metric: '${{ matrix.metric }}' - spec: '${{ matrix.spec }}' + metric: 'cosine' + spec: '{ "serverless": { "region": "us-west-2", "cloud": "aws" }}' PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' freshness_timeout_seconds: 600 -# data-plane-pod: -# name: Data plane pod integration tests -# runs-on: ubuntu-latest -# strategy: -# max-parallel: 1 -# matrix: -# use_grpc: [true, false] -# metric: [cosine, dotproduct] -# spec: -# - '{ "pod": { "environment": "us-east1-gcp", "pod_type": "p1" }}' -# steps: -# - uses: actions/checkout@v4 -# - uses: ./.github/actions/test-data-plane -# with: -# use_grpc: '${{ matrix.use_grpc }}' -# metric: '${{ matrix.metric }}' -# spec: '${{ matrix.spec }}' -# PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}' control-plane-pod: - name: control plane pod + name: control pod runs-on: ubuntu-latest strategy: matrix: @@ -92,7 +68,7 @@ jobs: freshness_timeout_seconds: 600 control-plane-serverless: - name: control plane serverless + name: control serverless runs-on: ubuntu-latest strategy: matrix: