Skip to content

Commit 6aa0af6

Browse files
committed
make http2 test configurable
1 parent 94a03cb commit 6aa0af6

File tree

10 files changed

+177
-58
lines changed

10 files changed

+177
-58
lines changed

.github/workflows/testing.yaml

Lines changed: 84 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
pull_request:
88
env:
99
UV_CACHE_DIR: /tmp/.uv-cache
10-
PYTHON_VERSION: "3.10"
10+
PYTHON_VERSION: "3.9"
1111
jobs:
1212
linting:
1313
runs-on: ubuntu-latest
@@ -42,6 +42,42 @@ jobs:
4242
matrix:
4343
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-beta.4"]
4444
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- name: install Just
48+
uses: taiki-e/install-action@just
49+
- name: Install uv
50+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
- name: Restore uv cache
56+
uses: actions/cache@v4
57+
with:
58+
path: ${{ env.UV_CACHE_DIR }}
59+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
60+
restore-keys: |
61+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
62+
uv-${{ runner.os }}
63+
- name: Install Dependencies
64+
run: just install
65+
- name: Test with pytest
66+
run: just test-parallel-ci
67+
- name: Upload coverage
68+
uses: codecov/codecov-action@v4
69+
with:
70+
token: ${{ secrets.CODECOV_TOKEN }}
71+
fail_ci_if_error: true
72+
- name: Minimize uv cache
73+
run: uv cache prune --ci
74+
75+
parallel-testing-http2:
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13.0-beta.4" ]
80+
runs-on: ubuntu-latest
4581
steps:
4682
- uses: actions/checkout@v4
4783
- name: install Just
@@ -71,7 +107,7 @@ jobs:
71107
brew install mkcert && \
72108
mkcert -install && \
73109
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1 && \
74-
just test-parallel-ci
110+
just test-parallel-ci-http2
75111
- name: Upload coverage
76112
uses: codecov/codecov-action@v4
77113
with:
@@ -107,15 +143,7 @@ jobs:
107143
- name: Install Dependencies
108144
run: just install
109145
- name: Test with pytest
110-
run: |
111-
sudo apt-get update && \
112-
sudo apt-get install -y libnss3-tools build-essential gcc && \
113-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
114-
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
115-
brew install mkcert && \
116-
mkcert -install && \
117-
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1 && \
118-
just test-no-parallel-ci
146+
run: just test-no-parallel-ci
119147
- name: Upload coverage
120148
uses: codecov/codecov-action@v4
121149
with:
@@ -124,6 +152,51 @@ jobs:
124152
- name: Minimize uv cache
125153
run: uv cache prune --ci
126154

155+
no-parallel-testing-http2:
156+
strategy:
157+
fail-fast: false
158+
matrix:
159+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-beta.4"]
160+
runs-on: ubuntu-latest
161+
steps:
162+
- uses: actions/checkout@v4
163+
- name: install Just
164+
uses: taiki-e/install-action@just
165+
- name: Install uv
166+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
167+
- name: Set up Python ${{ matrix.python-version }}
168+
uses: actions/setup-python@v5
169+
with:
170+
python-version: ${{ matrix.python-version }}
171+
- name: Restore uv cache
172+
uses: actions/cache@v4
173+
with:
174+
path: ${{ env.UV_CACHE_DIR }}
175+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
176+
restore-keys: |
177+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
178+
uv-${{ runner.os }}
179+
- name: Install Dependencies
180+
run: just install
181+
- name: Test with pytest
182+
run: |
183+
sudo apt-get update && \
184+
sudo apt-get install -y libnss3-tools build-essential gcc && \
185+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
186+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
187+
brew install mkcert && \
188+
mkcert -install && \
189+
mkcert -key-file meilisearch.key -cert-file meilisearch.crt localhost 127.0.0.1 ::1 && \
190+
just test-no-parallel-ci-http2
191+
- name: Upload coverage
192+
uses: codecov/codecov-action@v4
193+
with:
194+
token: ${{ secrets.CODECOV_TOKEN }}
195+
fail_ci_if_error: true
196+
- name: Minimize uv cache
197+
run: uv cache prune --ci
198+
199+
127200
docs:
128201
runs-on: ubuntu-latest
129202
steps:

benchmark/run_benchmark.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def benchmark_meili_add_documents_in_batches(
103103
async def run_async_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[float]:
104104
times = []
105105
for _ in track(range(10), description="Running async add in batches benchmark..."):
106-
async with AsyncClient("https://127.0.0.1:7700", "masterKey", verify=False) as client:
106+
async with AsyncClient("http://127.0.0.1:7700", "masterKey") as client:
107107
index = client.index("movies")
108108
_, time_taken = await benchmark_async_add_document_in_batches(client, data)
109109
times.append(time_taken)
@@ -118,7 +118,7 @@ async def run_async_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[flo
118118
async def run_async_search_benchmark(movies_sampled: list[str]) -> list[float]:
119119
times = []
120120
for _ in track(range(10), description="Running async multi search benchmark..."):
121-
async with AsyncClient("https://127.0.0.1:7700", "masterKey") as client:
121+
async with AsyncClient("http://127.0.0.1:7700", "masterKey") as client:
122122
index = client.index("movies")
123123
searches = []
124124
for movie in movies_sampled:
@@ -145,7 +145,7 @@ async def setup_index(data: Sequence[JsonMapping]) -> None:
145145
def run_sync_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[float]:
146146
times = []
147147
for _ in track(range(10), description="Running sync add in batches benchmark..."):
148-
client = Client("https://127.0.0.1:7700", "masterKey", verify=False)
148+
client = Client("http://127.0.0.1:7700", "masterKey")
149149
index = client.index("movies")
150150
_, time_taken = benchmark_sync_add_document_in_batches(client, data)
151151
times.append(time_taken)
@@ -158,7 +158,7 @@ def run_sync_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[float]:
158158

159159

160160
def run_sync_search_benchmark(movies_sampled: list[str]) -> list[float]:
161-
client = Client("https://127.0.0.1:7700", "masterKey")
161+
client = Client("http://127.0.0.1:7700", "masterKey")
162162
index = client.index("movies")
163163
times = []
164164
for _ in track(range(10), description="Running sync multi search benchmark..."):
@@ -174,7 +174,7 @@ def run_sync_search_benchmark(movies_sampled: list[str]) -> list[float]:
174174
def run_meili_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[float]:
175175
times = []
176176
for _ in track(range(10), description="Running meili add in batches benchmark..."):
177-
client = MeilisearchClient("https://127.0.0.1:7700", "masterKey")
177+
client = MeilisearchClient("http://127.0.0.1:7700", "masterKey")
178178
index = client.index("movies")
179179
_, time_taken = benchmark_meili_add_documents_in_batches(client, data)
180180
times.append(time_taken)
@@ -187,7 +187,7 @@ def run_meili_batch_add_benchmark(data: Sequence[JsonMapping]) -> list[float]:
187187

188188

189189
def run_meili_search_benchmark(movies_sampled: list[str]) -> list[float]:
190-
client = MeilisearchClient("https://127.0.0.1:7700", "masterKey")
190+
client = MeilisearchClient("http://127.0.0.1:7700", "masterKey")
191191
index = client.index("movies")
192192
times = []
193193
for _ in track(range(10), description="Running meili multi search benchmark..."):

docker-compose.https.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
meilisearch:
3+
image: getmeili/meilisearch:latest
4+
ports:
5+
- "7700:7700"
6+
environment:
7+
- MEILI_MASTER_KEY=masterKey
8+
- MEILI_NO_ANALYTICS=true
9+
volumes:
10+
- ./meilisearch.key:/meilisearch.key
11+
- ./meilisearch.crt:/meilisearch.crt
12+
command: ["meilisearch", "--ssl-cert-path", "/meilisearch.crt", "--ssl-key-path", "/meilisearch.key"]

docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@ services:
66
environment:
77
- MEILI_MASTER_KEY=masterKey
88
- MEILI_NO_ANALYTICS=true
9-
volumes:
10-
- ./meilisearch.key:/meilisearch.key
11-
- ./meilisearch.crt:/meilisearch.crt
12-
command: ["meilisearch", "--ssl-cert-path", "/meilisearch.crt", "--ssl-key-path", "/meilisearch.key"]

examples/add_documents_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
@add_documents(
1111
index_name="movies",
12-
connection_info=ConnectionInfo(url="https://127.0.0.1:7700", api_key="masterKey"),
12+
connection_info=ConnectionInfo(url="http://127.0.0.1:7700", api_key="masterKey"),
1313
)
1414
def load_documents() -> list[dict[str, Any]]:
1515
with open("../datasets/small_movies.json") as f:

justfile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,21 @@
1818
@test:
1919
-uv run pytest -x
2020

21+
@test-http2:
22+
-uv run pytest -x --http2
23+
2124
@test-parallel:
2225
-uv run pytest -n auto -x -m "not no_parallel"
2326

2427
@test-no-parallel:
2528
-uv run pytest -x -m "no_parallel"
2629

30+
@test-parallel-http2:
31+
-uv run pytest -n auto -x -m "not no_parallel" --http2
32+
33+
@test-no-parallel-http2:
34+
-uv run pytest -x -m "no_parallel" --http2
35+
2736
@test-ci: start-meilisearch-detached && stop-meilisearch
2837
uv run pytest --cov=meilisearch_python_sdk --cov-report=xml
2938

@@ -33,6 +42,13 @@
3342
@test-no-parallel-ci: start-meilisearch-detached && stop-meilisearch
3443
uv run pytest --cov=meilisearch_python_sdk --cov-report=xml -m "no_parallel"
3544

45+
@test-parallel-ci-http2: start-meilisearch-detached-http2 && stop-meilisearch-http2
46+
uv run pytest --cov=meilisearch_python_sdk --cov-report=xml -n auto -m "not no_parallel" --http2
47+
48+
@test-no-parallel-ci-http2: start-meilisearch-detached-http2 && stop-meilisearch-http2
49+
uv run pytest --cov=meilisearch_python_sdk --cov-report=xml -m "no_parallel" --http2
50+
51+
3652
@start-meilisearch:
3753
docker compose up
3854

@@ -42,6 +58,15 @@
4258
@stop-meilisearch:
4359
docker compose down
4460

61+
@start-meilisearch-http2:
62+
docker compose -f docker-compose.https.yml up
63+
64+
@start-meilisearch-detached-http2:
65+
docker compose -f docker-compose.https.yml up -d
66+
67+
@stop-meilisearch-http2:
68+
docker compose -f docker-compose.https.yml down
69+
4570
@build-docs:
4671
uv run mkdocs build --strict
4772

@@ -50,7 +75,6 @@
5075

5176
@install:
5277
uv sync --frozen --all-extras
53-
uv pip install truststore || true # truststore is not available for Python 3.9
5478

5579
@benchmark: start-meilisearch-detached && stop-meilisearch
5680
-uv run benchmark/run_benchmark.py

0 commit comments

Comments
 (0)