Skip to content

Commit 30977aa

Browse files
authored
fix: failing benchmarks due to incorrect parameters passed to method calls (#398)
1 parent 6004436 commit 30977aa

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

benchmarks/plugin_benchmarks.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,45 +124,46 @@ def plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugi
124124

125125

126126
def init_and_release(mocker, plugin_service_mock, plugin_manager):
127-
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service_mock, plugin_service_mock, plugin_service_mock, plugin_manager)
127+
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service_mock, plugin_service_mock, plugin_manager)
128128
wrapper.release_resources()
129129
return wrapper
130130

131131

132132
def test_init_and_release_with_execution_time_plugin(
133-
benchmark, plugin_service_mock, plugin_manager_with_execute_time_plugin):
133+
benchmark, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin):
134134

135-
result = benchmark(init_and_release, plugin_service_mock, plugin_manager_with_execute_time_plugin)
135+
result = benchmark(init_and_release, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin)
136136
assert result is not None
137137

138138

139139
def test_init_and_release_with_aurora_connection_tracker_plugin(
140-
benchmark, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_plugin):
140+
benchmark, mocker, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_plugin):
141141

142-
result = benchmark(init_and_release, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_plugin)
142+
result = benchmark(init_and_release, mocker, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_plugin)
143143
assert result is not None
144144

145145

146146
def test_init_and_release_with_execute_time_and_aurora_connection_tracker_plugin(
147-
benchmark, plugin_service_mock, plugin_manager_with_execute_time_and_aurora_connection_tracker_plugin):
147+
benchmark, mocker, plugin_service_mock, plugin_manager_with_execute_time_and_aurora_connection_tracker_plugin):
148148

149149
result = benchmark(
150-
init_and_release, plugin_service_mock, plugin_manager_with_execute_time_and_aurora_connection_tracker_plugin)
150+
init_and_release, mocker, plugin_service_mock, plugin_manager_with_execute_time_and_aurora_connection_tracker_plugin)
151151
assert result is not None
152152

153153

154154
def test_init_and_release_with_read_write_splitting_plugin(
155-
benchmark, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin):
155+
benchmark, mocker, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin):
156156

157-
result = benchmark(init_and_release, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin)
157+
result = benchmark(init_and_release, mocker, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin)
158158
assert result is not None
159159

160160

161161
def test_init_and_release_with_aurora_connection_tracker_and_read_write_splitting_plugin(
162-
benchmark, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin):
162+
benchmark, mocker, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin):
163163

164164
result = benchmark(
165165
init_and_release,
166+
mocker,
166167
plugin_service_mock,
167168
plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin)
168169
assert result is not None
@@ -182,45 +183,47 @@ def init_and_release_internal_connection_pools(mocker, plugin_service_mock, plug
182183

183184

184185
def test_init_and_release_with_read_write_splitting_plugin_internal_connection_pools(
185-
benchmark, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin):
186+
benchmark, mocker, plugin_service_mock, plugin_manager_with_read_write_splitting_plugin):
186187

187188
result = benchmark(
188189
init_and_release_internal_connection_pools,
190+
mocker,
189191
plugin_service_mock,
190192
plugin_manager_with_read_write_splitting_plugin)
191193
assert result is not None
192194

193195

194196
def test_init_and_release_with_aurora_connection_tracker_and_read_write_splitting_plugin_internal_connection_pools(
195-
benchmark, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin):
197+
benchmark, mocker, plugin_service_mock, plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin):
196198

197199
result = benchmark(
198200
init_and_release_internal_connection_pools,
201+
mocker,
199202
plugin_service_mock,
200203
plugin_manager_with_aurora_connection_tracker_and_read_write_splitting_plugin)
201204
assert result is not None
202205

203206

204207
def create_cursor_baseline(mocker, plugin_service, plugin_manager):
205-
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service, plugin_manager)
208+
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service, plugin_service, plugin_manager)
206209
cursor = wrapper.cursor()
207210
return cursor
208211

209212

210-
def test_create_cursor_baseline(benchmark, plugin_service_mock, plugin_manager_with_execute_time_plugin):
211-
result = benchmark(create_cursor_baseline, plugin_service_mock, plugin_manager_with_execute_time_plugin)
213+
def test_create_cursor_baseline(benchmark, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin):
214+
result = benchmark(create_cursor_baseline, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin)
212215
assert result is not None
213216

214217

215218
def execute_query(mocker, plugin_service, plugin_manager):
216-
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service, plugin_manager)
219+
wrapper = AwsWrapperConnection(mocker.MagicMock(), plugin_service, plugin_service, plugin_manager)
217220
cursor = wrapper.cursor()
218221
results = cursor.execute("some sql")
219222
return results
220223

221224

222225
def test_execute_query_with_execute_time_plugin(
223-
benchmark, plugin_service_mock, plugin_manager_with_execute_time_plugin):
226+
benchmark, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin):
224227

225-
result = benchmark(execute_query, plugin_service_mock, plugin_manager_with_execute_time_plugin)
228+
result = benchmark(execute_query, mocker, plugin_service_mock, plugin_manager_with_execute_time_plugin)
226229
assert result is not None

0 commit comments

Comments
 (0)