github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/docs/bucket/versioning/versioning-tests.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  if [ -n "$TEST_DEBUG" ]; then
     4  	set -x
     5  fi
     6  
     7  trap 'catch $LINENO' ERR
     8  
     9  # shellcheck disable=SC2120
    10  catch() {
    11  	if [ $# -ne 0 ]; then
    12  		echo "error on line $1"
    13  		echo "server logs ========="
    14  		cat "/tmp/sitea_1.log"
    15  		echo "==========================="
    16  		cat "/tmp/sitea_2.log"
    17  	fi
    18  
    19  	echo "Cleaning up instances of MinIO"
    20  	pkill minio
    21  	pkill -9 minio
    22  	rm -rf /tmp/multisitea
    23  }
    24  
    25  catch
    26  
    27  set -e
    28  export MINIO_CI_CD=1
    29  export MINIO_BROWSER=off
    30  export MINIO_ROOT_USER="minio"
    31  export MINIO_ROOT_PASSWORD="minio123"
    32  export MINIO_KMS_AUTO_ENCRYPTION=off
    33  export MINIO_PROMETHEUS_AUTH_TYPE=public
    34  export MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw=
    35  unset MINIO_KMS_KES_CERT_FILE
    36  unset MINIO_KMS_KES_KEY_FILE
    37  unset MINIO_KMS_KES_ENDPOINT
    38  unset MINIO_KMS_KES_KEY_NAME
    39  
    40  if [ ! -f ./mc ]; then
    41  	wget -O mc https://dl.minio.io/client/mc/release/linux-amd64/mc &&
    42  		chmod +x mc
    43  fi
    44  
    45  minio server --address ":9001" "https://localhost:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
    46  	"https://localhost:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_1.log 2>&1 &
    47  minio server --address ":9002" "https://localhost:9001/tmp/multisitea/data/disterasure/xl{1...4}" \
    48  	"https://localhost:9002/tmp/multisitea/data/disterasure/xl{5...8}" >/tmp/sitea_2.log 2>&1 &
    49  
    50  sleep 60
    51  
    52  export MC_HOST_sitea=https://minio:minio123@localhost:9001
    53  
    54  ./mc mb sitea/delissue --insecure
    55  
    56  ./mc version enable sitea/delissue --insecure
    57  
    58  echo hello | ./mc pipe sitea/delissue/hello --insecure
    59  
    60  ./mc version suspend sitea/delissue --insecure
    61  
    62  ./mc rm sitea/delissue/hello --insecure
    63  
    64  ./mc version enable sitea/delissue --insecure
    65  
    66  echo hello | ./mc pipe sitea/delissue/hello --insecure
    67  
    68  ./mc version suspend sitea/delissue --insecure
    69  
    70  ./mc rm sitea/delissue/hello --insecure
    71  
    72  count=$(./mc ls --versions sitea/delissue --insecure | wc -l)
    73  
    74  if [ ${count} -ne 3 ]; then
    75  	echo "BUG: expected number of versions to be '3' found ${count}"
    76  	echo "===== DEBUG ====="
    77  	./mc ls --versions sitea/delissue
    78  fi
    79  
    80  echo "SUCCESS:"
    81  ./mc ls --versions sitea/delissue --insecure
    82  
    83  catch