github.com/percona/percona-xtradb-cluster-operator@v1.14.0/e2e-tests/limits/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_cr_config() {
    11  	local cluster="$1"
    12  
    13  	desc "apply cr config"
    14  	apply_config $test_dir/conf/$cluster.yml
    15  
    16  	wait_for_running $cluster-pxc 1
    17  
    18  	desc "check if statefulset created with expected config"
    19  	compare_kubectl statefulset/$cluster-pxc
    20  	compare_kubectl statefulset/$cluster-proxysql
    21  
    22      desc "change resources"
    23      cat_config "$test_dir/conf/$cluster.yml" \
    24          | sed -e 's/300m/600m/' \
    25          | sed -e 's/500M/1G/' \
    26          | sed -e 's/600M/1G/' \
    27          | sed -e 's/0.5G/1G/' \
    28          | kubectl_bin apply -f-
    29      sleep 120
    30  
    31  	desc "check if statefulset was updated with expected config"
    32  	compare_kubectl statefulset/$cluster-pxc "-increased"
    33  	compare_kubectl statefulset/$cluster-proxysql "-increased"
    34  
    35  	desc "delete cluster"
    36  	kubectl_bin delete \
    37  		-f $test_dir/conf/$cluster.yml
    38  }
    39  
    40  main() {
    41  	create_infra $namespace
    42  	kubectl_bin apply -f $conf_dir/secrets.yml
    43  
    44  	desc 'check if possible to create cluster without CPU/Memory limits'
    45  	check_cr_config "no-limits"
    46  
    47  	desc 'check if possible to create cluster without CPU/Memory requests'
    48  	check_cr_config "no-requests"
    49  
    50  	desc 'check if possible to create cluster without CPU/Memory requests and limits'
    51  	check_cr_config "no-requests-no-limits"
    52  
    53  	destroy $namespace
    54  	desc "test passed"
    55  }
    56  
    57  main