github.com/greenplum-db/gpbackup@v0.0.0-20240517212602-89daab1885b3/ci/scripts/ddboost-plugin-tests.bash (about)

     1  #!/bin/bash
     2  
     3  set -ex
     4  
     5  # setup cluster and install gpbackup tools using gppkg
     6  ccp_src/scripts/setup_ssh_to_cluster.sh
     7  out=$(ssh -t cdw 'source env.sh && psql postgres -c "select version();"')
     8  GPDB_VERSION=$(echo ${out} | sed -n 's/.*Greenplum Database \([0-9]\).*/\1/p')
     9  
    10  # To prevent ddboost flaking with multiple pipelines due to backups running
    11  # with the same timestamps, the current time in nanoseconds lowers the gpbackup
    12  # timestamp collision rate. Nanoseconds for `date` command does not work on
    13  # macOS.
    14  TIME_NANO=$(date +%s%N)
    15  
    16  mkdir -p /tmp/untarred
    17  tar -xzf gppkgs/gpbackup-gppkgs.tar.gz -C /tmp/untarred
    18  scp /tmp/untarred/gpbackup_tools*gp${GPDB_VERSION}*${OS}*.gppkg cdw:/home/gpadmin
    19  ssh -t cdw "source env.sh; gppkg -i gpbackup_tools*.gppkg"
    20  
    21  cat <<SCRIPT > /tmp/run_tests.bash
    22  #!/bin/bash
    23  
    24  set -ex
    25  source env.sh
    26  
    27  pushd gpbackup_ddboost_plugin
    28  make test
    29  
    30  # important: whitespace of yaml below is critical, do not change it
    31  cat << CONFIG > \${HOME}/ddboost_config.yaml
    32  executablepath: \${GPHOME}/bin/gpbackup_ddboost_plugin
    33  options:
    34    hostname: ${DD_SOURCE_HOST}
    35    username: ${DD_USER}
    36    storage_unit: GPDB
    37    directory: gpbackup_tests${GPDB_VERSION}
    38    replication: "off"
    39    replication_streams: 10
    40    pgport: 5432
    41    password: ${DD_ENCRYPTED_PW}
    42    password_encryption: "on"
    43    remote_hostname: ${DD_DEST_HOST}
    44    remote_username: ${DD_USER}
    45    remote_storage_unit: GPDB
    46    remote_directory: gpbackup_tests${GPDB_VERSION}
    47    remote_password: ${DD_ENCRYPTED_PW}
    48    remote_password_encryption: "on"
    49    gpbackup_ddboost_plugin: 66706c6c6e677a6965796f68343365303133336f6c73366b316868326764
    50  CONFIG
    51  
    52  # important: whitespace of yaml below is critical, do not change it
    53  cat << CONFIG > \${HOME}/ddboost_config_replication.yaml
    54  executablepath: \${GPHOME}/bin/gpbackup_ddboost_plugin
    55  options:
    56    hostname: ${DD_SOURCE_HOST}
    57    username: ${DD_USER}
    58    storage_unit: GPDB
    59    directory: gpbackup_tests${GPDB_VERSION}
    60    replication: "on"
    61    pgport: 5432
    62    password: ${DD_ENCRYPTED_PW}
    63    password_encryption: "on"
    64    remote_hostname: ${DD_DEST_HOST}
    65    remote_username: ${DD_USER}
    66    remote_storage_unit: GPDB
    67    remote_directory: gpbackup_tests${GPDB_VERSION}
    68    remote_password: ${DD_ENCRYPTED_PW}
    69    remote_password_encryption: "on"
    70    gpbackup_ddboost_plugin: 66706c6c6e677a6965796f68343365303133336f6c73366b316868326764
    71  CONFIG
    72  
    73  # important: whitespace of yaml below is critical, do not change it
    74  cat << CONFIG > \${HOME}/ddboost_config_replication_restore.yaml
    75  executablepath: \${GPHOME}/bin/gpbackup_ddboost_plugin
    76  options:
    77    hostname: ${DD_DEST_HOST}
    78    username: ${DD_USER}
    79    password: ${DD_PW}
    80    storage_unit: GPDB
    81    directory: gpbackup_tests${GPDB_VERSION}
    82    pgport: 5432
    83  CONFIG
    84  
    85  pushd \${GOPATH}/src/github.com/greenplum-db/gpbackup/plugins
    86  
    87  ./plugin_test.sh \${GPHOME}/bin/gpbackup_ddboost_plugin \${HOME}/ddboost_config_replication.yaml \${HOME}/ddboost_config_replication_restore.yaml
    88  
    89  ./plugin_test.sh \${GPHOME}/bin/gpbackup_ddboost_plugin \${HOME}/ddboost_config.yaml \${HOME}/ddboost_config_replication_restore.yaml
    90  
    91  # exercise boostfs, which is mounted at /data/gpdata/dd_dir
    92  pushd \${GOPATH}/src/github.com/greenplum-db/gpbackup
    93  
    94  make end_to_end CUSTOM_BACKUP_DIR=/data/gpdata/dd_dir/end_to_end_GPDB${GPDB_VERSION}/${TIME_NANO}
    95  SCRIPT
    96  
    97  chmod +x /tmp/run_tests.bash
    98  scp /tmp/run_tests.bash cdw:/home/gpadmin/run_tests.bash
    99  ssh -t cdw "/home/gpadmin/run_tests.bash"