Skip to content

Commit 26b97ba

Browse files
committed
Skip connectAttrs test if performance_schema is disabled
1 parent 151e4dc commit 26b97ba

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

driver_test.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -2089,17 +2089,20 @@ func TestConnectAttrs(t *testing.T) {
20892089
defer db.Close()
20902090
dbt := &DBTest{t, db}
20912091

2092-
// performance_schema seems to be updated with a delay in some conditions, so first see if we are in list:
2093-
rows := dbt.mustQuery("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST where ID=CONNECTION_ID()")
2092+
rows := dbt.mustQuery("SHOW VARIABLES LIKE 'performance_schema'")
20942093
if rows.Next() {
2094+
var var_name, value string
2095+
rows.Scan(&var_name, &value)
2096+
if value != "ON" {
2097+
t.Skip("performance_schema is disabled")
2098+
}
20952099
} else {
2096-
dbt.Error("no data in processlist")
2100+
t.Skip("no performance_schema variable in mysql")
20972101
}
20982102

20992103
rows, err = dbt.db.Query("select attr_value from performance_schema.session_connect_attrs where processlist_id=CONNECTION_ID() and attr_name='program_name'")
21002104
if err != nil {
2101-
fmt.Println(err)
2102-
dbt.Skip("server probably does not support performance_schema.session_connect_attrs")
2105+
dbt.Skipf("server probably does not support performance_schema.session_connect_attrs: %s", err)
21032106
}
21042107

21052108
if rows.Next() {

0 commit comments

Comments
 (0)