github.com/percona/percona-xtradb-cluster-operator@v1.14.0/e2e-tests/affinity/run (about)

     1  #!/bin/bash
     2  
     3  set -o errexit
     4  
     5  test_dir=$(realpath $(dirname $0))
     6  . ${test_dir}/../functions
     7  
     8  set_debug
     9  
    10  check_affinity() {
    11  	local cluster="$1"
    12  	local skip_wait=$2
    13  
    14  	desc "apply cr config"
    15  	apply_config "$test_dir/conf/$cluster.yml"
    16  
    17  	desc "check if at least 1 Pod started"
    18  	if [ -z "$skip_wait" ]; then
    19  		wait_for_running $cluster-pxc 1
    20  	else
    21  		sleep 5
    22  	fi
    23  
    24  	desc "check if statefulset created with expected config"
    25  	compare_kubectl statefulset/$cluster-pxc
    26  	compare_kubectl statefulset/$cluster-proxysql
    27  
    28  	desc "delete cluster"
    29  	kubectl_bin delete \
    30  		-f $test_dir/conf/$cluster.yml
    31  }
    32  
    33  main() {
    34  	create_infra $namespace
    35  	kubectl_bin apply -f $conf_dir/secrets.yml
    36  
    37  	desc 'check hostname anti-affinity'
    38  	check_affinity "hostname"
    39  
    40  	desc 'check zone anti-affinity'
    41  	check_affinity "zone"
    42  
    43  	desc 'check region anti-affinity'
    44  	check_affinity "region"
    45  
    46  	desc 'check custom anti-affinity'
    47  	check_affinity "custom" "skip_wait"
    48  
    49  	destroy $namespace
    50  	desc "test passed"
    51  }
    52  
    53  main