Skip to content

Commit

Permalink
[mysql] fix tests + remove nonexistent metric
Browse files Browse the repository at this point in the history
  • Loading branch information
yannmh committed Apr 7, 2015
1 parent f7a652c commit 2ab2440
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
1 change: 0 additions & 1 deletion checks.d/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
'Innodb_data_reads': ('mysql.innodb.data_reads', RATE),
'Innodb_data_writes': ('mysql.innodb.data_writes', RATE),
'Innodb_os_log_fsyncs': ('mysql.innodb.os_log_fsyncs', RATE),
'Innodb_buffer_pool_size': ('mysql.innodb.buffer_pool_size', RATE),
'Slow_queries': ('mysql.performance.slow_queries', RATE),
'Questions': ('mysql.performance.questions', RATE),
'Queries': ('mysql.performance.queries', RATE),
Expand Down
24 changes: 7 additions & 17 deletions tests/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TestMySql(AgentCheckTest):
'mysql.performance.open_files',
'mysql.performance.table_locks_waited',
'mysql.performance.threads_connected',
'mysql.innodb.current_row_locks',
# 'mysql.innodb.current_row_locks', MariaDB status
'mysql.performance.open_tables',
]

Expand All @@ -63,7 +63,6 @@ class TestMySql(AgentCheckTest):
'mysql.innodb.data_reads',
'mysql.innodb.data_writes',
'mysql.innodb.os_log_fsyncs',
'mysql.innodb.buffer_pool_size',
'mysql.performance.slow_queries',
'mysql.performance.questions',
'mysql.performance.queries',
Expand All @@ -76,9 +75,9 @@ class TestMySql(AgentCheckTest):
'mysql.performance.com_delete_multi',
'mysql.performance.com_replace_select',
'mysql.performance.qcache_hits',
'mysql.innodb.mutex_spin_waits',
'mysql.innodb.mutex_spin_rounds',
'mysql.innodb.mutex_os_waits',
# 'mysql.innodb.mutex_spin_waits', MariaDB status
# 'mysql.innodb.mutex_spin_rounds', MariaDB status
# 'mysql.innodb.mutex_os_waits', MariaDB status
'mysql.performance.created_tmp_tables',
'mysql.performance.created_tmp_disk_tables',
'mysql.performance.created_tmp_files',
Expand Down Expand Up @@ -109,20 +108,11 @@ def test_check(self):
self.assertServiceCheck('mysql.can_connect', status=AgentCheck.OK,
tags=self.SC_TAGS, count=1)

print self.metrics
# Test gauge mandatory metrics
for mname in (self.INNODB_METRICS + self.SYSTEM_METRICS +
self.REPLICATION_METRICS + self.KEY_CACHE):
# Test metrics
for mname in (self.INNODB_METRICS + self.SYSTEM_METRICS + self.REPLICATION_METRICS +
self.KEY_CACHE + self.COMMON_GAUGES + self.COMMON_RATES):
self.assertMetric(mname, tags=self.METRIC_TAGS, count=1)

# Test optional metrics
# Gauges - at least 1 match
# self._test_optional_metrics(self.COMMON_GAUGES, at_least=1)

# Rates - at least 1 match
# self._test_optional_metrics(self.COMMON_RATES, at_least=1)
self.assertTrue(0 == 1)

# Raises when COVERAGE=true and coverage < 100%
self.coverage_report()

Expand Down

0 comments on commit 2ab2440

Please sign in to comment.