Skip to content

Commit 00d0c12

Browse files
committed
Add configs to run new tests in CI
1 parent 4478b85 commit 00d0c12

File tree

4 files changed

+133
-3
lines changed

4 files changed

+133
-3
lines changed

.github/actions/create-index/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ outputs:
3030
index_name:
3131
description: 'The name of the index, including randomized suffix'
3232
value: ${{ steps.create-index.outputs.index_name }}
33+
index_host:
34+
description: 'The host of the index'
35+
value: ${{ steps.create-index.outputs.index_host }}
36+
index_dimension:
37+
description: 'The dimension of the index'
38+
value: ${{ steps.create-index.outputs.index_dimension }}
39+
index_metric:
40+
description: 'The metric of the index'
41+
value: ${{ steps.create-index.outputs.index_metric }}
3342

3443
runs:
3544
using: 'composite'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Test Data Plane'
2+
description: 'Runs tests on the Pinecone data plane'
3+
4+
inputs:
5+
metric:
6+
description: 'The metric of the index'
7+
required: true
8+
dimension:
9+
description: 'The dimension of the index'
10+
required: true
11+
host:
12+
description: 'The host of the index'
13+
required: true
14+
use_grpc:
15+
description: 'Whether to use gRPC or REST'
16+
required: true
17+
freshness_timeout_seconds:
18+
description: 'The number of seconds to wait for the index to become fresh'
19+
required: false
20+
default: '60'
21+
PINECONE_API_KEY:
22+
description: 'The Pinecone API key'
23+
required: true
24+
25+
outputs:
26+
index_name:
27+
description: 'The name of the index, including randomized suffix'
28+
value: ${{ steps.create-index.outputs.index_name }}
29+
30+
runs:
31+
using: 'composite'
32+
steps:
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python_version }}
37+
38+
- name: Setup Poetry
39+
uses: ./.github/actions/setup-poetry
40+
with:
41+
include_grpc: ${{ inputs.use_grpc }}
42+
include_dev: 'true'
43+
44+
- name: Run data plane tests
45+
id: data-plane-tests
46+
shell: bash
47+
run: poetry run pytest tests/integration/data_asyncio
48+
env:
49+
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
50+
USE_GRPC: ${{ inputs.use_grpc }}
51+
METRIC: ${{ inputs.metric }}
52+
INDEX_HOST: ${{ inputs.host }}
53+
DIMENSION: ${{ inputs.dimension }}
54+
SPEC: ${{ inputs.spec }}
55+
FRESHNESS_TIMEOUT_SECONDS: ${{ inputs.freshness_timeout_seconds }}

.github/workflows/testing-integration.yaml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,64 @@ jobs:
2525
PINECONE_DEBUG_CURL: 'true'
2626
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
2727

28+
data-plane-setup:
29+
name: Create index
30+
runs-on: ubuntu-latest
31+
outputs:
32+
index_name: ${{ steps.setup-index.outputs.index_name }}
33+
index_host: ${{ steps.setup-index.outputs.index_host }}
34+
index_dimension: ${{ steps.setup-index.outputs.index_dimension }}
35+
index_metric: ${{ steps.setup-index.outputs.index_metric }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Create index
39+
id: setup-index
40+
uses: ./.github/actions/create-index
41+
timeout-minutes: 5
42+
with:
43+
dimension: 100
44+
metric: 'cosine'
45+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
46+
47+
48+
test-data-plane-asyncio:
49+
name: Data plane asyncio integration tests
50+
runs-on: ubuntu-latest
51+
needs:
52+
- data-plane-setup
53+
outputs:
54+
index_name: ${{ needs.data-plane-setup.outputs.index_name }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
python_version: [3.8, 3.12]
59+
use_grpc: [true]
60+
spec:
61+
- '{ "asyncio": { "environment": "us-east1-gcp" }}'
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: ./.github/actions/test-data-plane-asyncio
65+
with:
66+
python_version: '${{ matrix.python_version }}'
67+
use_grpc: '${{ matrix.use_grpc }}'
68+
metric: '${{ needs.data-plane-setup.outputs.index_metric }}'
69+
dimension: '${{ needs.data-plane-setup.outputs.index_dimension }}'
70+
host: '${{ needs.data-plane-setup.outputs.index_host }}'
71+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
72+
freshness_timeout_seconds: 600
73+
74+
data-plane-asyncio-cleanup:
75+
name: Deps cleanup
76+
runs-on: ubuntu-latest
77+
needs:
78+
- test-data-plane-asyncio
79+
steps:
80+
- uses: actions/checkout@v4
81+
- uses: ./.github/actions/delete-index
82+
with:
83+
index_name: '${{ needs.test-data-plane-asyncio.outputs.index_name }}'
84+
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
85+
2886
data-plane-serverless:
2987
name: Data plane serverless integration tests
3088
runs-on: ubuntu-latest
@@ -33,7 +91,7 @@ jobs:
3391
matrix:
3492
python_version: [3.8, 3.12]
3593
use_grpc: [true, false]
36-
metric:
94+
metric:
3795
- cosine
3896
# - euclidean
3997
# - dotproduct

scripts/create.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,22 @@ def generate_index_name(test_name: str) -> str:
5959

6060
def main():
6161
pc = Pinecone(api_key=read_env_var("PINECONE_API_KEY"))
62+
6263
index_name = generate_index_name(read_env_var("NAME_PREFIX") + random_string(20))
64+
dimension = int(read_env_var("DIMENSION"))
65+
metric = read_env_var("METRIC")
66+
6367
pc.create_index(
6468
name=index_name,
65-
metric=read_env_var("METRIC"),
66-
dimension=int(read_env_var("DIMENSION")),
69+
metric=metric,
70+
dimension=dimension,
6771
spec={"serverless": {"cloud": read_env_var("CLOUD"), "region": read_env_var("REGION")}},
6872
)
73+
desc = pc.describe_index(index_name)
6974
write_gh_output("index_name", index_name)
75+
write_gh_output("index_host", desc.host)
76+
write_gh_output("index_metric", metric)
77+
write_gh_output("index_dimension", dimension)
7078

7179

7280
if __name__ == "__main__":

0 commit comments

Comments
 (0)