Improved mysql plugin

shows global variables
	shows slave statuses
	shows size and count of binary log files
	shows information_schema.processlist stats
	shows perf table stats
	shows auto increments stats from information schema
	shows perf index stats
	shows table lock waits summary by table
	shows time and operations of event waits
	shows file event statuses
	shows events statements stats from perf_schema
	shows schema statistics
	refactored plugin, provided multiple fields per insert
This commit is contained in:
maksadbek 2015-12-22 12:06:39 +05:00 committed by Maksadbek
parent f2394b5a8d
commit bac3dd5a83
2 changed files with 1170 additions and 31 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
package mysql package mysql
import ( import (
"database/sql"
"fmt" "fmt"
"testing" "testing"
@ -115,3 +116,47 @@ func TestMysqlDNSAddTimeout(t *testing.T) {
} }
} }
} }
func TestParseValue(t *testing.T) {
testCases := []struct {
rawByte sql.RawBytes
value float64
boolValue bool
}{
{sql.RawBytes("Yes"), 1, true},
{sql.RawBytes("No"), 0, false},
{sql.RawBytes("ON"), 1, true},
{sql.RawBytes("OFF"), 0, false},
{sql.RawBytes("ABC"), 0, false},
}
for _, cases := range testCases {
if value, ok := parseValue(cases.rawByte); value != cases.value && ok != cases.boolValue {
t.Errorf("want %d with %t, got %d with %t", int(cases.value), cases.boolValue, int(value), ok)
}
}
}
func TestNewNamespace(t *testing.T) {
testCases := []struct {
words []string
namespace string
}{
{
[]string{"thread", "info_scheme", "query update"},
"thread_info_scheme_query_update",
},
{
[]string{"thread", "info_scheme", "query_update"},
"thread_info_scheme_query_update",
},
{
[]string{"thread", "info", "scheme", "query", "update"},
"thread_info_scheme_query_update",
},
}
for _, cases := range testCases {
if got := newNamespace(cases.words...); got != cases.namespace {
t.Errorf("want %s, got %s", cases.namespace, got)
}
}
}