Skip to content

Commit d7fc9cd

Browse files
authored
Fix MySQL metric name in tests (#592)
* Fix mysql metric name test * Fix version gating * Fix version gating again * Remove py36 testing * Add cache ignore for pip * Pip cache purge * Revert "Pip cache purge" This reverts commit 3b9eac2. * Remove caching changes
1 parent c80abfa commit d7fc9cd

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/datastore_mysql/test_database.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@
2525
DB_NAMESPACE = DB_SETTINGS["namespace"]
2626
DB_PROCEDURE = "hello_" + DB_NAMESPACE
2727

28+
mysql_version = tuple(int(x) for x in mysql.connector.__version__.split(".")[:3])
29+
if mysql_version >= (8, 0, 30):
30+
_connector_metric_name = 'Function/mysql.connector.pooling:connect'
31+
else:
32+
_connector_metric_name = 'Function/mysql.connector:connect'
33+
2834
_test_execute_via_cursor_scoped_metrics = [
29-
('Function/mysql.connector:connect', 1),
35+
(_connector_metric_name, 1),
3036
('Datastore/statement/MySQL/datastore_mysql_%s/select' % DB_NAMESPACE, 1),
3137
('Datastore/statement/MySQL/datastore_mysql_%s/insert' % DB_NAMESPACE, 1),
3238
('Datastore/statement/MySQL/datastore_mysql_%s/update' % DB_NAMESPACE, 1),
@@ -103,7 +109,7 @@ def test_execute_via_cursor(table_name):
103109
connection.commit()
104110

105111
_test_connect_using_alias_scoped_metrics = [
106-
('Function/mysql.connector:connect', 1),
112+
(_connector_metric_name, 1),
107113
('Datastore/statement/MySQL/datastore_mysql_%s/select' % DB_NAMESPACE, 1),
108114
('Datastore/statement/MySQL/datastore_mysql_%s/insert' % DB_NAMESPACE, 1),
109115
('Datastore/statement/MySQL/datastore_mysql_%s/update' % DB_NAMESPACE, 1),

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ envlist =
7474
elasticsearchserver07-datastore_elasticsearch-{py27,py36,py37,py38,py39,py310,pypy,pypy36}-elasticsearch{07},
7575
memcached-datastore_memcache-{py27,py36,py37,py38,py39,py310,pypy,pypy36}-memcached01,
7676
mysql-datastore_mysql-mysql080023-py27,
77-
mysql-datastore_mysql-mysqllatest-{py36,py37,py38,py39,py310},
77+
mysql-datastore_mysql-mysqllatest-{py37,py38,py39,py310},
7878
postgres-datastore_postgresql-{py36,py37,py38,py39},
7979
postgres-datastore_psycopg2-{py27,py36,py37,py38,py39,py310}-psycopg20208,
8080
postgres-datastore_psycopg2cffi-{py27,py36,pypy}-psycopg2cffi{0207,0208},

0 commit comments

Comments
 (0)