github.com/greenplum-db/gpbackup@v0.0.0-20240517212602-89daab1885b3/ci/scripts/test-on-local-cluster.bash (about) 1 #!/bin/bash 2 3 set -ex 4 5 # Add locale for locale tests 6 localedef -c -i de_DE -f UTF-8 de_DE 7 echo LANG=\"de_DE\" >> /etc/locale.conf 8 source /etc/locale.conf 9 10 ## old versions of ld have a bug that our CGO libs exercise. update binutils to avoid it 11 set +e 12 OLDLDVERSION=$(ld --version | grep "2.25"); 13 set -e 14 15 mkdir /tmp/untarred 16 tar -xzf gppkgs/gpbackup-gppkgs.tar.gz -C /tmp/untarred 17 if [[ -d gp-pkg ]] ; then 18 mkdir /tmp/gppkgv2 19 tar -xzf gp-pkg/gppkg* -C /tmp/gppkgv2 20 fi 21 22 if [[ ! -f bin_gpdb/bin_gpdb.tar.gz ]] ; then 23 mv bin_gpdb/*.tar.gz bin_gpdb/bin_gpdb.tar.gz 24 fi 25 source gpdb_src/concourse/scripts/common.bash 26 time install_gpdb 27 time ./gpdb_src/concourse/scripts/setup_gpadmin_user.bash 28 time NUM_PRIMARY_MIRROR_PAIRS=${LOCAL_CLUSTER_SIZE} make_cluster 29 30 cat <<SCRIPT > /tmp/run_tests.bash 31 #!/bin/bash 32 33 set -ex 34 35 # use "temp build dir" of parent shell 36 export GOPATH=\${HOME}/go 37 export PATH=/usr/local/go/bin:\$PATH:\${GOPATH}/bin:/opt/rh/devtoolset-7/root/usr/bin/ 38 if [[ -f /opt/gcc_env.sh ]]; then 39 source /opt/gcc_env.sh 40 fi 41 mkdir -p \${GOPATH}/bin \${GOPATH}/src/github.com/greenplum-db 42 cp -R $(pwd)/gpbackup \${GOPATH}/src/github.com/greenplum-db/ 43 44 # Install dependencies before sourcing greenplum path. Using the GPDB curl is causing issues. 45 pushd \${GOPATH}/src/github.com/greenplum-db/gpbackup 46 make depend 47 popd 48 49 source /usr/local/greenplum-db-devel/greenplum_path.sh 50 source $(pwd)/gpdb_src/gpAux/gpdemo/gpdemo-env.sh 51 52 mkdir -p "\${GPHOME}/postgresql" 53 54 if [ ${REQUIRES_DUMMY_SEC} ]; then 55 # dummy security label: copy library from bucket to correct location 56 install -m 755 -T $(pwd)/dummy_seclabel/dummy_seclabel*.so "\${GPHOME}/lib/postgresql/dummy_seclabel.so" 57 58 editConfig() { 59 echo "editing \$1" 60 sed -i "s/^shared_preload_libraries=.*//g" \$1 && echo "shared_preload_libraries='dummy_seclabel'" >> \$1 61 } 62 63 export -f editConfig 64 find $(pwd)/gpdb_src -name postgresql.conf -exec bash -c 'editConfig "\$0"' {} \; 65 gpstop -ra 66 fi 67 68 # Install gpbackup gppkg 69 out=\$(psql postgres -c "select version();") 70 GPDB_VERSION=\$(echo \$out | sed -n 's/.*Greenplum Database \([0-9]\).*/\1/p') 71 72 if [[ -f /tmp/gppkgv2/gppkg ]] ; then 73 /tmp/gppkgv2/gppkg install -a /tmp/untarred/gpbackup*gp\${GPDB_VERSION}*${OS}*.gppkg 74 else 75 gppkg -i /tmp/untarred/gpbackup*gp\${GPDB_VERSION}*${OS}*.gppkg 76 fi 77 78 # Get the GPDB version to use for the unit tests 79 export TEST_GPDB_VERSION=\$(echo \$out | sed -n 's/.*Greenplum Database \([0-9].[0-9]\+.[0-9]\+\).*/\1/p') 80 81 # Test gpbackup 82 pushd \${GOPATH}/src/github.com/greenplum-db/gpbackup 83 make unit integration end_to_end 84 popd 85 SCRIPT 86 87 chmod +x /tmp/run_tests.bash 88 su - gpadmin "/tmp/run_tests.bash" 89