github.com/greenplum-db/gpbackup@v0.0.0-20240517212602-89daab1885b3/ci/scripts/all-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  TEST_GPDB_VERSION=$(echo ${out} | sed -n 's/.*Greenplum Database \([0-9].[0-9]\+.[0-9]\+\).*/\1/p')
     9  GPDB_VERSION=$(echo ${TEST_GPDB_VERSION} | head -c 1)
    10  mkdir -p /tmp/untarred
    11  tar -xzf gppkgs/gpbackup-gppkgs.tar.gz -C /tmp/untarred
    12  scp /tmp/untarred/gpbackup_tools*gp${GPDB_VERSION}*${OS}*.gppkg cdw:/home/gpadmin
    13  ssh -t cdw "source env.sh; gppkg -q gpbackup*gp*.gppkg | grep 'is installed' || gppkg -i gpbackup_tools*.gppkg"
    14  
    15  # place correct tarballs in gpbackup dir for consumption
    16  if [[ -f "bin_gpbackup_1.0.0_and_1.7.1/gpbackup_bins_1.0.0_and_1.7.1.tar.gz" ]] && \
    17     [[ "${GPBACKUP_VERSION}" != "" ]] ; then
    18    tar -xzf bin_gpbackup_1.0.0_and_1.7.1/gpbackup_bins_1.0.0_and_1.7.1.tar.gz -C /tmp/
    19    scp -r /tmp/${GPBACKUP_VERSION} cdw:/tmp
    20  fi
    21  
    22  cat <<SCRIPT > /tmp/run_tests.bash
    23    #!/bin/bash
    24  
    25    set -ex
    26    source env.sh
    27    cd \${GOPATH}/src/github.com/greenplum-db/gpbackup
    28    export OLD_BACKUP_VERSION="${GPBACKUP_VERSION}"
    29  
    30    # Set the GPDB version to use for the unit tests
    31    export TEST_GPDB_VERSION=${TEST_GPDB_VERSION}
    32  
    33    make unit integration
    34  
    35    # NOTE: This is a temporary hotfix intended to skip these tests when running on CCP cluster
    36    #       because the backup artifact that these tests are using only works on local clusters.
    37    sed -i 's|\tIt\(.*\)\(--on-error-continue\)|\tPIt\1\2|' end_to_end/end_to_end_suite_test.go
    38  
    39    if [ -z "\${OLD_BACKUP_VERSION}" ] ; then
    40      make end_to_end
    41    else
    42      make install helper_path=/tmp/\${OLD_BACKUP_VERSION}/gpbackup_helper
    43      ginkgo -r --randomize-suites --poll-progress-after=0s --randomize-all --no-color end_to_end -- --custom_backup_dir "/tmp" 2>&1
    44    fi
    45  SCRIPT
    46  
    47  chmod +x /tmp/run_tests.bash
    48  scp /tmp/run_tests.bash cdw:/home/gpadmin/run_tests.bash
    49  ssh -t cdw "/home/gpadmin/run_tests.bash"