Explorar o código

fix --column-statistics handling in mysql tests (#1680)

mmetc %!s(int64=3) %!d(string=hai) anos
pai
achega
e13867f7c9
Modificáronse 1 ficheiros con 5 adicións e 10 borrados
  1. 5 10
      tests/lib/db/instance-mysql

+ 5 - 10
tests/lib/db/instance-mysql

@@ -51,19 +51,14 @@ setup() {
 
 
 dump() {
 dump() {
     backup_file="${1?Missing file to backup database to}"
     backup_file="${1?Missing file to backup database to}"
-    COLUMN_STATISTICS=
+
+    args=(mysqldump)
     if mysqldump --column-statistics 2>&1 | grep -q -v 'unknown option'; then
     if mysqldump --column-statistics 2>&1 | grep -q -v 'unknown option'; then
-        COLUMN_STATISTICS='--column-statistics=0'
+        args+=("--column-statistics=0")
     fi
     fi
+    args+=("--host=${MYSQL_HOST}" "--port=${MYSQL_PORT}" "--user=${MYSQL_USER}" "--password=${MYSQL_PASSWORD}" --databases crowdsec_test)
 
 
-    silence_password_warning \
-        mysqldump \
-        "${COLUMN_STATISTICS}" \
-        "--host=${MYSQL_HOST}" \
-        "--port=${MYSQL_PORT}" \
-        "--user=${MYSQL_USER}" \
-        "--password=${MYSQL_PASSWORD}" \
-        --databases crowdsec_test > "${backup_file}"
+    silence_password_warning "${args[@]}" > "${backup_file}"
 }
 }
 
 
 restore() {
 restore() {