Skip to content

Commit 0d9cd28

Browse files
committed
Fix mapbox tests
Using `elasticsearch_url` does not work in serverless as API key authentication is required. Also, `node_class` parametrization does not make sense, we parametrize at the CI job level. And finally, the sync case was missing a refresh.
1 parent b0f990d commit 0d9cd28

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

test_elasticsearch_serverless/test_async/test_server/test_mapbox_vector_tile.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ async def mvt_setup(async_client):
7373
)
7474

7575

76-
async def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup):
77-
client = AsyncElasticsearch(elasticsearch_url)
78-
await client.search_mvt(
76+
async def test_mapbox_vector_tile_error(async_client, mvt_setup):
77+
await async_client.search_mvt(
7978
index="museums",
8079
zoom=13,
8180
x=4207,
@@ -84,7 +83,7 @@ async def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup):
8483
)
8584

8685
with pytest.raises(RequestError) as e:
87-
await client.search_mvt(
86+
await async_client.search_mvt(
8887
index="museums",
8988
zoom=-100,
9089
x=4207,
@@ -113,15 +112,13 @@ async def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup):
113112
}
114113

115114

116-
async def test_mapbox_vector_tile_response(elasticsearch_url, mvt_setup):
115+
async def test_mapbox_vector_tile_response(async_client, mvt_setup):
117116
try:
118117
import mapbox_vector_tile
119118
except ImportError:
120119
return pytest.skip("Requires the 'mapbox-vector-tile' package")
121120

122-
client = AsyncElasticsearch(elasticsearch_url)
123-
124-
resp = await client.search_mvt(
121+
resp = await async_client.search_mvt(
125122
index="museums",
126123
zoom=13,
127124
x=4207,

test_elasticsearch_serverless/test_server/test_mapbox_vector_tile.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ def mvt_setup(sync_client):
6767
"included": True,
6868
},
6969
],
70+
refresh=True,
7071
)
7172

7273

73-
@pytest.mark.parametrize("node_class", ["urllib3", "requests"])
74-
def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup, node_class):
75-
client = Elasticsearch(elasticsearch_url, node_class=node_class)
76-
client.search_mvt(
74+
def test_mapbox_vector_tile_error(sync_client, mvt_setup):
75+
sync_client.search_mvt(
7776
index="museums",
7877
zoom=13,
7978
x=4207,
@@ -82,7 +81,7 @@ def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup, node_class):
8281
)
8382

8483
with pytest.raises(RequestError) as e:
85-
client.search_mvt(
84+
sync_client.search_mvt(
8685
index="museums",
8786
zoom=-100,
8887
x=4207,
@@ -111,16 +110,13 @@ def test_mapbox_vector_tile_error(elasticsearch_url, mvt_setup, node_class):
111110
}
112111

113112

114-
@pytest.mark.parametrize("node_class", ["urllib3", "requests"])
115-
def test_mapbox_vector_tile_response(elasticsearch_url, mvt_setup, node_class):
113+
def test_mapbox_vector_tile_response(sync_client, mvt_setup):
116114
try:
117115
import mapbox_vector_tile
118116
except ImportError:
119117
return pytest.skip("Requires the 'mapbox-vector-tile' package")
120118

121-
client = Elasticsearch(elasticsearch_url, node_class=node_class)
122-
123-
resp = client.search_mvt(
119+
resp = sync_client.search_mvt(
124120
index="museums",
125121
zoom=13,
126122
x=4207,

0 commit comments

Comments
 (0)