github.com/percona/percona-xtradb-cluster-operator@v1.14.0/e2e-tests/scaling/run (about) 1 #!/bin/bash 2 3 set -o errexit 4 5 test_dir=$(realpath $(dirname $0)) 6 . ${test_dir}/../functions 7 cluster="scaling" 8 9 set_debug 10 11 create_infra $namespace 12 spinup_pxc "$cluster" "$test_dir/conf/$cluster.yml" 13 14 desc 'scale up from 3 to 5' 15 cat_config "$test_dir/conf/$cluster.yml" \ 16 | sed -e 's/size: 3/size: 5/' \ 17 | kubectl_bin apply -f- 18 19 desc 'check if all 5 Pods started' 20 wait_for_running $cluster-pxc 5 21 sleep 15 22 23 desc 'check if PVC created' 24 compare_kubectl pvc/datadir-$cluster-pxc-3 25 compare_kubectl pvc/datadir-$cluster-pxc-4 26 27 desc 'check data consistency for new Pods' 28 compare_mysql_cmd "select-1" "SELECT * from myApp.myApp;" "-h $cluster-pxc-3.$cluster-pxc -uroot -proot_password" 29 compare_mysql_cmd "select-1" "SELECT * from myApp.myApp;" "-h $cluster-pxc-4.$cluster-pxc -uroot -proot_password" 30 sleep 15 31 32 desc 'check new Pods exists in ProxySQL' 33 run_mysql_local "SELECT hostname FROM runtime_mysql_servers WHERE status='ONLINE';" "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0" \ 34 | grep "$cluster-pxc-3" 35 run_mysql_local "SELECT hostname FROM runtime_mysql_servers WHERE status='ONLINE';" "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0" \ 36 | grep "$cluster-pxc-4" 37 38 desc 'scale down from 5 to 3' 39 apply_config "$test_dir/conf/$cluster.yml" 40 sleep 25 41 42 desc 'check if Pod deleted' 43 wait_for_delete pod/$cluster-pxc-3 44 wait_for_delete pod/$cluster-pxc-4 45 46 desc 'check if PVC not deleted' 47 compare_kubectl pvc/datadir-$cluster-pxc-3 48 compare_kubectl pvc/datadir-$cluster-pxc-4 49 50 desc 'check if Pod deleted from ProxySQL' 51 run_mysql_local "SELECT hostname FROM runtime_mysql_servers WHERE status='ONLINE' AND hostgroup_id!=13;" "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0" \ 52 | (grep "$cluster-pxc-3" && exit 1 || :) 53 run_mysql_local "SELECT hostname FROM runtime_mysql_servers WHERE status='ONLINE' AND hostgroup_id!=13;" "-h127.0.0.1 -P6032 -uproxyadmin -padmin_password" "$cluster-proxysql-0" \ 54 | (grep "$cluster-pxc-4" && exit 1 || :) 55 56 destroy $namespace 57 desc "test passed"