github.com/pingcap/br@v5.3.0-alpha.0.20220125034240-ec59c7b6ce30+incompatible/tests/docker_compatible_s3/prepare.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright 2020 PingCAP, Inc.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  # This test is used to generate backup for later compatible test.
    17  set -eux
    18  
    19  BUCKET="test"
    20  # start the s3 server
    21  MINIO_ACCESS_KEY='brs3accesskey'
    22  MINIO_SECRET_KEY='brs3secretkey'
    23  S3_ENDPOINT=minio:24927
    24  S3_KEY="&access-key=$MINIO_ACCESS_KEY&secret-access-key=$MINIO_SECRET_KEY"
    25  
    26  # create bucket
    27  /usr/bin/mc config host add minio http://$S3_ENDPOINT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
    28  /usr/bin/mc mb minio/test --ignore-existing
    29  
    30  # backup cluster data
    31  run_sql_in_container "backup database test to 's3://$BUCKET/bk${TAG}?endpoint=http://$S3_ENDPOINT$S3_KEY&force-path-style=true';"