github.com/cloudberrydb/gpbackup@v1.0.3-0.20240118031043-5410fd45eed6/ci/scripts/test-on-local-cluster.bash (about)

     1  #!/bin/bash
     2  
     3  set -ex
     4  
     5  GO_VERSION=1.17.6
     6  
     7  # If go is not installed or it's not the expected version, install the expected version
     8  if ! command -v go &> /dev/null || ! $(go version | grep -q ${GO_VERSION}); then
     9    wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz
    10    rm -rf /usr/local/go && tar -xzf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local
    11  fi
    12  
    13  # Add locale for locale tests
    14  localedef -c -i de_DE -f UTF-8 de_DE
    15  echo LANG=\"de_DE\" >> /etc/locale.conf
    16  source /etc/locale.conf
    17  
    18  mkdir /tmp/untarred
    19  tar -xzf gppkgs/gpbackup-gppkgs.tar.gz -C /tmp/untarred
    20  
    21  if [[ ! -f bin_gpdb/bin_gpdb.tar.gz ]] ; then
    22    mv bin_gpdb/*.tar.gz bin_gpdb/bin_gpdb.tar.gz
    23  fi
    24  source gpdb_src/concourse/scripts/common.bash
    25  time install_gpdb
    26  time ./gpdb_src/concourse/scripts/setup_gpadmin_user.bash
    27  time NUM_PRIMARY_MIRROR_PAIRS=${LOCAL_CLUSTER_SIZE} make_cluster
    28  
    29  cat <<SCRIPT > /tmp/run_tests.bash
    30  #!/bin/bash
    31  
    32  set -ex
    33  
    34  # use "temp build dir" of parent shell
    35  export GOPATH=\${HOME}/go
    36  export PATH=/usr/local/go/bin:\$PATH:\${GOPATH}/bin:/opt/rh/devtoolset-7/root/usr/bin/
    37  if [[ -f /opt/gcc_env.sh ]]; then
    38      source /opt/gcc_env.sh
    39  fi
    40  mkdir -p \${GOPATH}/bin \${GOPATH}/src/github.com/greenplum-db
    41  cp -R $(pwd)/gpbackup \${GOPATH}/src/github.com/greenplum-db/
    42  
    43  # Install dependencies before sourcing greenplum path. Using the GPDB curl is causing issues.
    44  pushd \${GOPATH}/src/github.com/cloudberrydb/gpbackup
    45    make depend
    46  popd
    47  
    48  source /usr/local/greenplum-db-devel/greenplum_path.sh
    49  source $(pwd)/gpdb_src/gpAux/gpdemo/gpdemo-env.sh
    50  
    51  mkdir -p "\${GPHOME}/postgresql"
    52  
    53  if [ ${REQUIRES_DUMMY_SEC} ]; then
    54    # dummy security label: copy library from bucket to correct location
    55    install -m 755 -T $(pwd)/dummy_seclabel/dummy_seclabel*.so "\${GPHOME}/lib/postgresql/dummy_seclabel.so"
    56    gpconfig -c shared_preload_libraries -v dummy_seclabel
    57    gpstop -ra
    58    gpconfig -s shared_preload_libraries | grep dummy_seclabel
    59  fi
    60  
    61  # Install gpbackup gppkg
    62  out=\$(psql postgres -c "select version();")
    63  GPDB_VERSION=\$(echo \$out | sed -n 's/.*Greenplum Database \([0-9]\).*/\1/p')
    64  gppkg -i /tmp/untarred/gpbackup*gp\${GPDB_VERSION}*${OS}*.gppkg
    65  
    66  # Get the GPDB version to use for the unit tests
    67  export TEST_GPDB_VERSION=\$(echo \$out | sed -n 's/.*Greenplum Database \([0-9].[0-9]\+.[0-9]\+\).*/\1/p')
    68  
    69  # Test gpbackup
    70  pushd \${GOPATH}/src/github.com/cloudberrydb/gpbackup
    71    make unit integration end_to_end
    72  popd
    73  SCRIPT
    74  
    75  chmod +x /tmp/run_tests.bash
    76  su - gpadmin "/tmp/run_tests.bash"
    77