Skip to content

Commit 706351e

Browse files
committed
Run tests on prod
1 parent 8b90e34 commit 706351e

File tree

16 files changed

+61
-44
lines changed

16 files changed

+61
-44
lines changed

.github/actions/cleanup-all/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inputs:
1212
PINECONE_ADDITIONAL_HEADERS:
1313
description: 'Additional headers to send with the request'
1414
required: false
15-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
15+
default: '{"sdk-test-suite": "pinecone-python-client"}'
1616

1717
runs:
1818
using: 'composite'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inputs:
2626
PINECONE_ADDITIONAL_HEADERS:
2727
description: 'Additional headers to send with the request'
2828
required: false
29-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
29+
default: '{"sdk-test-suite": "pinecone-python-client"}'
3030

3131
runs:
3232
using: 'composite'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ inputs:
2828
PINECONE_ADDITIONAL_HEADERS:
2929
description: 'Additional headers to send with the request'
3030
required: false
31-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
31+
default: '{"sdk-test-suite": "pinecone-python-client"}'
3232

3333

3434
outputs:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ inputs:
1111
PINECONE_ADDITIONAL_HEADERS:
1212
description: 'Additional headers to send with the request'
1313
required: false
14-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
14+
default: '{"sdk-test-suite": "pinecone-python-client"}'
1515

1616

1717
runs:

.github/actions/test-data-asyncio/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ inputs:
1818
PINECONE_ADDITIONAL_HEADERS:
1919
description: 'Additional headers to send with the request'
2020
required: false
21-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
21+
default: '{"sdk-test-suite": "pinecone-python-client"}'
2222
python_version:
2323
description: 'The version of Python to use'
2424
required: false

.github/actions/test-data-plane/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ inputs:
2121
PINECONE_ADDITIONAL_HEADERS:
2222
description: 'Additional headers to send with the request'
2323
required: false
24-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
24+
default: '{"sdk-test-suite": "pinecone-python-client"}'
2525
python_version:
2626
description: 'The version of Python to use'
2727
required: false

.github/actions/test-dependency-asyncio-rest/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
PINECONE_ADDITIONAL_HEADERS:
99
description: 'Additional headers to send with the request'
1010
required: false
11-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
11+
default: '{"sdk-test-suite": "pinecone-python-client"}'
1212
index_name:
1313
description: 'The name of the index'
1414
required: true

.github/actions/test-dependency-grpc/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
PINECONE_ADDITIONAL_HEADERS:
99
description: 'Additional headers to send with the request'
1010
required: false
11-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
11+
default: '{"sdk-test-suite": "pinecone-python-client"}'
1212
index_name:
1313
description: 'The name of the index'
1414
required: true

.github/actions/test-dependency-rest/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
PINECONE_ADDITIONAL_HEADERS:
99
description: 'Additional headers to send with the request'
1010
required: false
11-
default: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
11+
default: '{"sdk-test-suite": "pinecone-python-client"}'
1212
index_name:
1313
description: 'The name of the index'
1414
required: true

.github/workflows/testing-dependency-asyncio.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
python_version: '${{ matrix.python_version }}'
2828
index_name: '${{ inputs.index_name }}'
2929
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
30-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
30+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
3131
aiohttp_version: '${{ matrix.aiohttp_version }}'

.github/workflows/testing-dependency-grpc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
python_version: '${{ matrix.python_version }}'
5454
index_name: '${{ inputs.index_name }}'
5555
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
56-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
56+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
5757
grpcio_version: '${{ matrix.grpcio_version }}'
5858
lz4_version: '${{ matrix.lz4_version }}'
5959
protobuf_version: '${{ matrix.protobuf_version }}'
@@ -87,7 +87,7 @@ jobs:
8787
python_version: '${{ matrix.python_version }}'
8888
index_name: '${{ inputs.index_name }}'
8989
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
90-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
90+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
9191
grpcio_version: '${{ matrix.grpcio_version }}'
9292
lz4_version: '${{ matrix.lz4_version }}'
9393
protobuf_version: '${{ matrix.protobuf_version }}'
@@ -120,7 +120,7 @@ jobs:
120120
python_version: '${{ matrix.python_version }}'
121121
index_name: '${{ inputs.index_name }}'
122122
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
123-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
123+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
124124
grpcio_version: '${{ matrix.grpcio_version }}'
125125
lz4_version: '${{ matrix.lz4_version }}'
126126
protobuf_version: '${{ matrix.protobuf_version }}'

.github/workflows/testing-dependency-rest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python_version: '${{ matrix.python_version }}'
3131
index_name: '${{ inputs.index_name }}'
3232
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
33-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
33+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
3434
urllib3_version: '${{ matrix.urllib3_version }}'
3535

3636

@@ -54,7 +54,7 @@ jobs:
5454
python_version: '${{ matrix.python_version }}'
5555
index_name: '${{ inputs.index_name }}'
5656
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
57-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
57+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
5858
urllib3_version: '${{ matrix.urllib3_version }}'
5959

6060
dependency-matrix-rest-313:
@@ -77,5 +77,5 @@ jobs:
7777
python_version: '${{ matrix.python_version }}'
7878
index_name: '${{ inputs.index_name }}'
7979
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
80-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
80+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
8181
urllib3_version: '${{ matrix.urllib3_version }}'

.github/workflows/testing-dependency.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name_prefix: depstest-${{ github.run_number }}
2020
dimension: 2
2121
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
22-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
22+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
2323

2424
dependency-test-rest:
2525
uses: './.github/workflows/testing-dependency-rest.yaml'
@@ -56,4 +56,4 @@ jobs:
5656
with:
5757
index_name: '${{ needs.deps-test-setup.outputs.index_name }}'
5858
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
59-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
59+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'

.github/workflows/testing-integration-asyncio.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: poetry run pytest tests/integration/data_asyncio --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG
3030
env:
3131
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
32-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
32+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
3333

3434
db-control-asyncio:
3535
name: db_control asyncio
@@ -55,4 +55,4 @@ jobs:
5555
run: poetry run pytest tests/integration/control_asyncio/*.py --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG
5656
env:
5757
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
58-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
58+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'

.github/workflows/testing-integration.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
env:
1010
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
11-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
11+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
1212
strategy:
1313
fail-fast: false
1414
matrix:
@@ -54,7 +54,7 @@ jobs:
5454
run: poetry run pytest tests/integration/inference --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG
5555
env:
5656
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
57-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
57+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
5858

5959
plugins:
6060
name: Plugin installation
@@ -76,7 +76,7 @@ jobs:
7676
run: poetry run pytest tests/integration/plugins --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG
7777
env:
7878
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
79-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
79+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
8080

8181

8282

@@ -107,7 +107,7 @@ jobs:
107107
metric: 'cosine'
108108
spec: '{ "serverless": { "region": "us-west-2", "cloud": "aws" }}'
109109
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
110-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
110+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
111111
freshness_timeout_seconds: 600
112112
skip_weird_id_tests: 'true'
113113

@@ -172,6 +172,6 @@ jobs:
172172
run: poetry run pytest tests/integration/control/serverless --retries 2 --retry-delay 35 -s -vv --log-cli-level=DEBUG
173173
env:
174174
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
175-
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client", "x-environment": "preprod-aws-0"}'
175+
PINECONE_ADDITIONAL_HEADERS: '{"sdk-test-suite": "pinecone-python-client"}'
176176
SERVERLESS_CLOUD: '${{ matrix.testConfig.serverless.cloud }}'
177177
SERVERLESS_REGION: '${{ matrix.testConfig.serverless.region }}'

tests/integration/data_asyncio/test_query.py

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,57 @@
44
from .conftest import build_asyncioindex_client, poll_for_freshness
55
from ..helpers import random_string, embedding_values
66

7+
import logging
8+
9+
logger = logging.getLogger(__name__)
10+
711

812
@pytest.mark.asyncio
913
@pytest.mark.parametrize("target_namespace", [random_string(20)])
1014
async def test_query(index_host, dimension, target_namespace):
1115
asyncio_idx = build_asyncioindex_client(index_host)
16+
logger.info(f"Testing query on index {index_host}")
17+
logger.info(f"Target namespace: {target_namespace}")
18+
logger.info(f"Dimension: {dimension}")
1219

1320
def emb():
1421
return embedding_values(dimension)
1522

1623
# Upsert with tuples
17-
await asyncio_idx.upsert(
18-
vectors=[("1", emb()), ("2", emb()), ("3", emb())], namespace=target_namespace
19-
)
24+
tuple_vectors = [("1", emb()), ("2", emb()), ("3", emb())]
25+
logger.info(f"Upserting {len(tuple_vectors)} vectors")
26+
await asyncio_idx.upsert(vectors=tuple_vectors, namespace=target_namespace)
2027

2128
# Upsert with objects
22-
await asyncio_idx.upsert(
23-
vectors=[
24-
Vector(id="4", values=emb(), metadata={"genre": "action"}),
25-
Vector(id="5", values=emb(), metadata={"genre": "action"}),
26-
Vector(id="6", values=emb(), metadata={"genre": "horror"}),
27-
],
28-
namespace=target_namespace,
29-
)
29+
object_vectors = [
30+
Vector(id="4", values=emb(), metadata={"genre": "action"}),
31+
Vector(id="5", values=emb(), metadata={"genre": "action"}),
32+
Vector(id="6", values=emb(), metadata={"genre": "horror"}),
33+
]
34+
logger.info(f"Upserting {len(object_vectors)} vectors")
35+
await asyncio_idx.upsert(vectors=object_vectors, namespace=target_namespace)
3036

3137
# Upsert with dict
32-
await asyncio_idx.upsert(
33-
vectors=[
34-
{"id": "7", "values": emb()},
35-
{"id": "8", "values": emb()},
36-
{"id": "9", "values": emb()},
37-
],
38-
namespace=target_namespace,
39-
)
38+
dict_vectors = [
39+
{"id": "7", "values": emb()},
40+
{"id": "8", "values": emb()},
41+
{"id": "9", "values": emb()},
42+
]
43+
logger.info(f"Upserting {len(dict_vectors)} vectors")
44+
await asyncio_idx.upsert(vectors=dict_vectors, namespace=target_namespace)
4045

4146
await poll_for_freshness(asyncio_idx, target_namespace, 9)
4247

4348
# Check the vector count reflects some data has been upserted
4449
stats = await asyncio_idx.describe_index_stats()
50+
logger.info(f"Index stats: {stats}")
4551
assert stats.total_vector_count >= 9
4652
# default namespace could have other stuff from other tests
4753
if target_namespace != "":
4854
assert stats.namespaces[target_namespace].vector_count == 9
4955

5056
results1 = await asyncio_idx.query(top_k=4, namespace=target_namespace, vector=emb())
57+
logger.info(f"Results 1: {results1}")
5158
assert results1 is not None
5259
assert len(results1.matches) == 4
5360
assert results1.namespace == target_namespace
@@ -67,6 +74,7 @@ def emb():
6774
results2 = await asyncio_idx.query(
6875
top_k=4, namespace=target_namespace, vector=emb(), include_values=True
6976
)
77+
logger.info(f"Results 2: {results2}")
7078
assert results2 is not None
7179
assert len(results2.matches) == 4
7280
assert results2.namespace == target_namespace
@@ -81,6 +89,7 @@ def emb():
8189
include_metadata=True,
8290
include_values=True,
8391
)
92+
logger.info(f"Results 3: {results3}")
8493
assert results3 is not None
8594
assert len(results3.matches) == 2
8695
assert results3.namespace == target_namespace
@@ -97,6 +106,7 @@ def emb():
97106
include_metadata=True,
98107
include_values=True,
99108
)
109+
logger.info(f"Results 4: {results4}")
100110
assert results4 is not None
101111
assert len(results4.matches) == 1
102112
assert results4.namespace == target_namespace
@@ -113,6 +123,7 @@ def emb():
113123
include_metadata=True,
114124
include_values=True,
115125
)
126+
logger.info(f"Results 5: {results5}")
116127
assert results5 is not None
117128
assert len(results5.matches) == 0
118129
assert results5.namespace == target_namespace
@@ -122,27 +133,32 @@ def emb():
122133

123134
# Query by id
124135
results6 = await asyncio_idx.query(top_k=4, id="1", namespace=target_namespace)
136+
logger.info(f"Results 6: {results6}")
125137
assert results6 is not None
126138
assert len(results6.matches) == 4
127139

128140
# Query by id, when id doesn't exist gives empty result set
129141
results7 = await asyncio_idx.query(top_k=10, id="unknown", namespace=target_namespace)
142+
logger.info(f"Results 7: {results7}")
130143
assert results7 is not None
131144
assert len(results7.matches) == 0
132145

133146
# When missing required top_k kwarg
134147
with pytest.raises(TypeError) as e:
135148
await asyncio_idx.query(id="1", namespace=target_namespace)
149+
logger.info(f"Error Msg 1: {e.value}")
136150
assert "top_k" in str(e.value)
137151

138152
# When incorrectly passing top_k as a positional argument
139153
with pytest.raises(TypeError) as e:
140154
await asyncio_idx.query(4, id="1", namespace=target_namespace)
155+
logger.info(f"Error Msg 2: {e.value}")
141156
assert "top_k" in str(e.value)
142157

143158
# When trying to pass both id and vector as query params
144159
with pytest.raises(ValueError) as e:
145160
await asyncio_idx.query(top_k=10, id="1", vector=emb(), namespace=target_namespace)
161+
logger.info(f"Error Msg 3: {e.value}")
146162
assert "Cannot specify both `id` and `vector`" in str(e.value)
147163

148164
# When trying to pass sparse vector as query params to dense index
@@ -152,5 +168,6 @@ def emb():
152168
sparse_vector={"indices": [i for i in range(dimension)], "values": emb()},
153169
namespace=target_namespace,
154170
)
171+
logger.info(f"Error Msg 4: {e.value}")
155172
assert "Cannot query index with dense 'vector_type' with only sparse vector" in str(e.value)
156173
await asyncio_idx.close()

0 commit comments

Comments
 (0)