From d2dce1c9456ecf731ba86f0c6ae954c70750fbb0 Mon Sep 17 00:00:00 2001
From: Daniel Black <daniel@mariadb.org>
Date: Thu, 4 Mar 2021 11:19:26 +1100
Subject: [PATCH] MDEV-6536: galera IPv6 tests to connect using IPv6

---
 mysql-test/include/galera_connect.inc                | 12 ++++++++++--
 mysql-test/suite/galera_3nodes/t/GAL-501.test        |  1 +
 .../galera_3nodes/t/galera_ipv6_mariabackup.test     |  1 +
 .../t/galera_ipv6_mariabackup_section.test           |  1 +
 .../suite/galera_3nodes/t/galera_ipv6_mysqldump.test |  1 +
 .../suite/galera_3nodes/t/galera_ipv6_rsync.test     |  1 +
 .../galera_3nodes/t/galera_ipv6_rsync_section.test   |  1 +
 7 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/mysql-test/include/galera_connect.inc b/mysql-test/include/galera_connect.inc
index a40b03bf421..5e72cf9ed23 100644
--- a/mysql-test/include/galera_connect.inc
+++ b/mysql-test/include/galera_connect.inc
@@ -11,6 +11,9 @@
 # $galera_connection_name
 #   Name of the resulting connection.
 #
+# $galera_connection_address
+#   IP to connect to for galera (defaults to 127.0.0.1)
+#
 # $galera_server_number
 #   Sequence number of the node in the galera cluster.
 #
@@ -28,6 +31,11 @@ if (!$galera_server_number)
   --die ERROR IN TEST: $galera_server_number must be set before sourcing include/galera_connect.inc
 }
 
+if (!$galera_connection_address)
+{
+  --let $galera_connection_address= 127.0.0.1
+}
+
 --let $_galera_port= \$NODE_MYPORT_$galera_server_number
 if (!$_galera_port)
 {
@@ -38,7 +46,7 @@ if (!$_galera_port)
 if ($galera_debug)
 {
 --disable_query_log
-  --echo connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,)
+  --echo connect($galera_connection_name,$galera_connection_address,root,,test,$_galera_port,)
 --enable_query_log
 }
 
@@ -47,5 +55,5 @@ if ($galera_debug)
 
 # Open a connection
 --disable_query_log
---connect($galera_connection_name,127.0.0.1,root,,test,$_galera_port,)
+--connect($galera_connection_name,$galera_connection_address,root,,test,$_galera_port,)
 --enable_query_log
diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.test b/mysql-test/suite/galera_3nodes/t/GAL-501.test
index af5b83ae261..ecf1c7660d1 100644
--- a/mysql-test/suite/galera_3nodes/t/GAL-501.test
+++ b/mysql-test/suite/galera_3nodes/t/GAL-501.test
@@ -4,6 +4,7 @@
 # wsrep_node_address=[::1]
 # ist.recv_addr=[::1]
 
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/force_restart.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
index 31613454348..51778f40ddf 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
@@ -1,3 +1,4 @@
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/have_innodb.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
index 3b2ca0892f1..ad14d4480a6 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test
@@ -1,3 +1,4 @@
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/have_innodb.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
index f5dd1aeb06d..5d000e08c79 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test
@@ -1,3 +1,4 @@
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/force_restart.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
index 448611e34e0..04a88675752 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.test
@@ -1,3 +1,4 @@
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/force_restart.inc
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
index 448611e34e0..04a88675752 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test
@@ -1,3 +1,4 @@
+--let galera_connection_address=::1
 --source include/galera_cluster.inc
 --source include/check_ipv6.inc
 --source include/force_restart.inc