Skip to content

Commit 8bf634c

Browse files
authored
Migrate to Container-Based Testing and Add Host-Based Index Targeting (#44)
Container-Based Testing Infrastructure Local development: Docker containers for all Pinecone operations CI/CD integration: GitHub Actions runs against local containers No external dependencies: Tests run without API keys or network calls Enhanced validation: Tests verify actual data content, not just HTTP status codes 🔧 Technical Changes API Enhancements Added host parameter to Pinecone::Client#index() Added global host configuration: Pinecone.configure { |c| c.host = "..." } HTTP/HTTPS protocol detection (HTTP for localhost, HTTPS for production) Improved error handling and validation Test Infrastructure Overhaul Removed VCR dependencies across all specs Container-based testing for vector operations (dense: 5081, sparse: 5082, database: 5080) Strategic mocking for control plane operations (collections) Enhanced validations verify actual data presence, not just key existence
1 parent cb06d64 commit 8bf634c

File tree

80 files changed

+1686
-27233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1686
-27233
lines changed

.github/workflows/ruby.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,61 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
ruby-version: ['3.2', '3.3']
24+
ruby-version: ['3.4']
2525
env:
2626
PINECONE_API_KEY: sekret
27-
PINECONE_ENVIRONMENT: us-east1-gcp
27+
services:
28+
pinecone-database:
29+
image: ghcr.io/pinecone-io/pinecone-local:latest
30+
env:
31+
PORT: 5080
32+
PINECONE_HOST: localhost
33+
ports:
34+
- 5080:5080
35+
36+
dense-index:
37+
image: ghcr.io/pinecone-io/pinecone-index:latest
38+
env:
39+
PORT: 5081
40+
INDEX_TYPE: serverless
41+
VECTOR_TYPE: dense
42+
DIMENSION: 2
43+
METRIC: cosine
44+
ports:
45+
- 5081:5081
46+
47+
sparse-index:
48+
image: ghcr.io/pinecone-io/pinecone-index:latest
49+
env:
50+
PORT: 5082
51+
INDEX_TYPE: serverless
52+
VECTOR_TYPE: sparse
53+
DIMENSION: 0
54+
METRIC: dotproduct
55+
ports:
56+
- 5082:5082
57+
2858
steps:
2959
- uses: actions/checkout@v3
60+
3061
- name: Set up Ruby
31-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
32-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
62+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
63+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
3364
uses: ruby/setup-ruby@v1
3465
with:
3566
ruby-version: ${{ matrix.ruby-version }}
3667
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
68+
69+
- name: Wait for Pinecone containers to be ready
70+
run: |
71+
echo "Waiting for Pinecone containers to be ready..."
72+
timeout 60 bash -c 'until curl -f http://localhost:5080/indexes; do echo "Waiting for database container..."; sleep 2; done'
73+
timeout 60 bash -c 'until curl -f http://localhost:5081/vectors/list; do echo "Waiting for dense index container..."; sleep 2; done'
74+
timeout 60 bash -c 'until curl -f http://localhost:5082/vectors/list; do echo "Waiting for sparse index container..."; sleep 2; done'
75+
echo "All Pinecone containers are ready!"
3776
3877
- name: Run StandardRB Lint
3978
run: bundle exec standardrb
79+
4080
- name: Run tests
4181
run: bundle exec rspec

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.env
22
scratch/
33
*.gem
4-
settings.json
4+
settings.json
5+
plans/
6+
mise.toml

Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
# frozen_string_literal: true
2+
13
source "https://rubygems.org"
24

35
gemspec
46

5-
gem "dotenv", "~> 2.8"
67
gem "awesome_print", "~> 1.9"
7-
gem "rake", "~> 13.0"
88
gem "debug", "~> 1.7"
9+
gem "dotenv", "~> 2.8"
10+
gem "rake", "~> 13.0"
911
gem "rspec", "~> 3.12"
10-
gem "webmock", "~> 3.14"
11-
gem "vcr", "~> 6.1"
1212
gem "standard", "~> 1.33"
13+
gem "vcr", "~> 6.1"
14+
gem "webmock", "~> 3.14"

Gemfile.lock

Lines changed: 106 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -9,131 +9,159 @@ PATH
99
GEM
1010
remote: https://rubygems.org/
1111
specs:
12-
addressable (2.8.4)
13-
public_suffix (>= 2.0.2, < 6.0)
14-
ast (2.4.2)
12+
addressable (2.8.7)
13+
public_suffix (>= 2.0.2, < 7.0)
14+
ast (2.4.3)
1515
awesome_print (1.9.2)
16-
concurrent-ruby (1.2.2)
17-
crack (0.4.5)
16+
base64 (0.3.0)
17+
bigdecimal (3.2.2)
18+
concurrent-ruby (1.3.5)
19+
crack (1.0.0)
20+
bigdecimal
1821
rexml
19-
csv (3.3.0)
20-
debug (1.7.2)
21-
irb (>= 1.5.0)
22-
reline (>= 0.3.1)
23-
diff-lcs (1.5.0)
22+
csv (3.3.5)
23+
date (3.4.1)
24+
debug (1.11.0)
25+
irb (~> 1.10)
26+
reline (>= 0.3.8)
27+
diff-lcs (1.6.2)
2428
dotenv (2.8.1)
25-
dry-configurable (1.0.1)
26-
dry-core (~> 1.0, < 2)
29+
dry-configurable (1.3.0)
30+
dry-core (~> 1.1)
2731
zeitwerk (~> 2.6)
28-
dry-core (1.0.0)
32+
dry-core (1.1.0)
2933
concurrent-ruby (~> 1.0)
34+
logger
3035
zeitwerk (~> 2.6)
31-
dry-inflector (1.0.0)
32-
dry-initializer (3.1.1)
33-
dry-logic (1.5.0)
36+
dry-inflector (1.2.0)
37+
dry-initializer (3.2.0)
38+
dry-logic (1.6.0)
39+
bigdecimal
3440
concurrent-ruby (~> 1.0)
35-
dry-core (~> 1.0, < 2)
41+
dry-core (~> 1.1)
3642
zeitwerk (~> 2.6)
37-
dry-schema (1.13.1)
43+
dry-schema (1.14.1)
3844
concurrent-ruby (~> 1.0)
3945
dry-configurable (~> 1.0, >= 1.0.1)
40-
dry-core (~> 1.0, < 2)
41-
dry-initializer (~> 3.0)
42-
dry-logic (>= 1.4, < 2)
43-
dry-types (>= 1.7, < 2)
46+
dry-core (~> 1.1)
47+
dry-initializer (~> 3.2)
48+
dry-logic (~> 1.5)
49+
dry-types (~> 1.8)
4450
zeitwerk (~> 2.6)
45-
dry-struct (1.6.0)
46-
dry-core (~> 1.0, < 2)
47-
dry-types (>= 1.7, < 2)
51+
dry-struct (1.8.0)
52+
dry-core (~> 1.1)
53+
dry-types (~> 1.8, >= 1.8.2)
4854
ice_nine (~> 0.11)
4955
zeitwerk (~> 2.6)
50-
dry-types (1.7.1)
56+
dry-types (1.8.3)
57+
bigdecimal (~> 3.0)
5158
concurrent-ruby (~> 1.0)
5259
dry-core (~> 1.0)
5360
dry-inflector (~> 1.0)
5461
dry-logic (~> 1.4)
5562
zeitwerk (~> 2.6)
56-
dry-validation (1.10.0)
63+
dry-validation (1.11.1)
5764
concurrent-ruby (~> 1.0)
58-
dry-core (~> 1.0, < 2)
59-
dry-initializer (~> 3.0)
60-
dry-schema (>= 1.12, < 2)
65+
dry-core (~> 1.1)
66+
dry-initializer (~> 3.2)
67+
dry-schema (~> 1.14)
6168
zeitwerk (~> 2.6)
62-
hashdiff (1.0.1)
69+
erb (5.0.1)
70+
hashdiff (1.2.0)
6371
httparty (0.22.0)
6472
csv
6573
mini_mime (>= 1.0.0)
6674
multi_xml (>= 0.5.2)
6775
ice_nine (0.11.2)
68-
io-console (0.6.0)
69-
irb (1.6.4)
70-
reline (>= 0.3.0)
71-
json (2.7.1)
72-
language_server-protocol (3.17.0.3)
76+
io-console (0.8.0)
77+
irb (1.15.2)
78+
pp (>= 0.6.0)
79+
rdoc (>= 4.0.0)
80+
reline (>= 0.4.2)
81+
json (2.12.2)
82+
language_server-protocol (3.17.0.5)
7383
lint_roller (1.1.0)
74-
mini_mime (1.1.2)
75-
multi_xml (0.6.0)
76-
parallel (1.24.0)
77-
parser (3.3.0.5)
84+
logger (1.7.0)
85+
mini_mime (1.1.5)
86+
multi_xml (0.7.2)
87+
bigdecimal (~> 3.1)
88+
parallel (1.27.0)
89+
parser (3.3.8.0)
7890
ast (~> 2.4.1)
7991
racc
80-
public_suffix (5.0.1)
81-
racc (1.7.3)
92+
pp (0.6.2)
93+
prettyprint
94+
prettyprint (0.2.0)
95+
prism (1.4.0)
96+
psych (5.2.6)
97+
date
98+
stringio
99+
public_suffix (6.0.2)
100+
racc (1.8.1)
82101
rainbow (3.1.1)
83-
rake (13.0.6)
84-
regexp_parser (2.9.0)
85-
reline (0.3.3)
102+
rake (13.3.0)
103+
rdoc (6.14.1)
104+
erb
105+
psych (>= 4.0.0)
106+
regexp_parser (2.10.0)
107+
reline (0.6.1)
86108
io-console (~> 0.5)
87-
rexml (3.2.5)
88-
rspec (3.12.0)
89-
rspec-core (~> 3.12.0)
90-
rspec-expectations (~> 3.12.0)
91-
rspec-mocks (~> 3.12.0)
92-
rspec-core (3.12.2)
93-
rspec-support (~> 3.12.0)
94-
rspec-expectations (3.12.3)
109+
rexml (3.4.1)
110+
rspec (3.13.1)
111+
rspec-core (~> 3.13.0)
112+
rspec-expectations (~> 3.13.0)
113+
rspec-mocks (~> 3.13.0)
114+
rspec-core (3.13.4)
115+
rspec-support (~> 3.13.0)
116+
rspec-expectations (3.13.5)
95117
diff-lcs (>= 1.2.0, < 2.0)
96-
rspec-support (~> 3.12.0)
97-
rspec-mocks (3.12.5)
118+
rspec-support (~> 3.13.0)
119+
rspec-mocks (3.13.5)
98120
diff-lcs (>= 1.2.0, < 2.0)
99-
rspec-support (~> 3.12.0)
100-
rspec-support (3.12.0)
101-
rubocop (1.59.0)
121+
rspec-support (~> 3.13.0)
122+
rspec-support (3.13.4)
123+
rubocop (1.75.8)
102124
json (~> 2.3)
103-
language_server-protocol (>= 3.17.0)
125+
language_server-protocol (~> 3.17.0.2)
126+
lint_roller (~> 1.1.0)
104127
parallel (~> 1.10)
105-
parser (>= 3.2.2.4)
128+
parser (>= 3.3.0.2)
106129
rainbow (>= 2.2.2, < 4.0)
107-
regexp_parser (>= 1.8, < 3.0)
108-
rexml (>= 3.2.5, < 4.0)
109-
rubocop-ast (>= 1.30.0, < 2.0)
130+
regexp_parser (>= 2.9.3, < 3.0)
131+
rubocop-ast (>= 1.44.0, < 2.0)
110132
ruby-progressbar (~> 1.7)
111-
unicode-display_width (>= 2.4.0, < 3.0)
112-
rubocop-ast (1.30.0)
113-
parser (>= 3.2.1.0)
114-
rubocop-performance (1.20.2)
115-
rubocop (>= 1.48.1, < 2.0)
116-
rubocop-ast (>= 1.30.0, < 2.0)
133+
unicode-display_width (>= 2.4.0, < 4.0)
134+
rubocop-ast (1.45.1)
135+
parser (>= 3.3.7.2)
136+
prism (~> 1.4)
137+
rubocop-performance (1.25.0)
138+
lint_roller (~> 1.1)
139+
rubocop (>= 1.75.0, < 2.0)
140+
rubocop-ast (>= 1.38.0, < 2.0)
117141
ruby-progressbar (1.13.0)
118-
standard (1.33.0)
142+
standard (1.50.0)
119143
language_server-protocol (~> 3.17.0.2)
120144
lint_roller (~> 1.0)
121-
rubocop (~> 1.59.0)
145+
rubocop (~> 1.75.5)
122146
standard-custom (~> 1.0.0)
123-
standard-performance (~> 1.3)
147+
standard-performance (~> 1.8)
124148
standard-custom (1.0.2)
125149
lint_roller (~> 1.0)
126150
rubocop (~> 1.50)
127-
standard-performance (1.3.1)
151+
standard-performance (1.8.0)
128152
lint_roller (~> 1.1)
129-
rubocop-performance (~> 1.20.2)
130-
unicode-display_width (2.5.0)
131-
vcr (6.1.0)
132-
webmock (3.18.1)
153+
rubocop-performance (~> 1.25.0)
154+
stringio (3.1.7)
155+
unicode-display_width (3.1.4)
156+
unicode-emoji (~> 4.0, >= 4.0.4)
157+
unicode-emoji (4.0.4)
158+
vcr (6.3.1)
159+
base64
160+
webmock (3.25.1)
133161
addressable (>= 2.8.0)
134162
crack (>= 0.3.2)
135163
hashdiff (>= 0.4.0, < 2.0.0)
136-
zeitwerk (2.6.8)
164+
zeitwerk (2.7.3)
137165

138166
PLATFORMS
139167
arm64-darwin-21

0 commit comments

Comments
 (0)