Skip to content

CI Integration Tests #19

CI Integration Tests

CI Integration Tests #19

name: CI Integration Tests
on:
workflow_dispatch:
jobs:
test:
strategy:
matrix:
python: ['3.7', '3.8', '3.9']
runs-on: macos-10.15
name: Integration test
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Check out repository code
uses: actions/checkout@v2
- name: Download Vantage Express
shell: bash
run: |
brew install hudochenkov/sshpass/sshpass
echo "my IP address is: " $(ipconfig getifaddr en0)
mkdir /tmp/downloads
cd /tmp/downloads
curl -L 'https://downloads.teradata.com/download/cdn/database/teradata-express/VantageExpress17.10_Sles12_202108300444.7z' \
-H 'Cookie: $TD_DOWNLOADS_MAGIC_COOKIE' --compressed -o ve.7z
env:
TD_DOWNLOADS_MAGIC_COOKIE: ${{ secrets.TD_DOWNLOADS_MAGIC_COOKIE }}
- name: Unzip Vantage Express
shell: bash
run: |
cd /tmp/downloads
7z x ve.7z
- name: Install Vantage Express
shell: bash
run: |
export VM_IMAGE_DIR="/tmp/downloads/VantageExpress17.10_Sles12"
DEFAULT_VM_NAME="vantage-express-17.10"
VM_NAME="${VM_NAME:-$DEFAULT_VM_NAME}"
vboxmanage createvm --name "$VM_NAME" --register --ostype openSUSE_64
vboxmanage modifyvm "$VM_NAME" --ioapic on --memory 6000 --vram 128 --nic1 nat --cpus 3
vboxmanage storagectl "$VM_NAME" --name "SATA Controller" --add sata --controller IntelAhci
vboxmanage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$(find $VM_IMAGE_DIR -name '*disk1*')"
vboxmanage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium "$(find $VM_IMAGE_DIR -name '*disk2*')"
vboxmanage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium "$(find $VM_IMAGE_DIR -name '*disk3*')"
vboxmanage modifyvm "$VM_NAME" --natpf1 "tdssh,tcp,,4422,,22"
vboxmanage modifyvm "$VM_NAME" --natpf1 "tddb,tcp,,1025,,1025"
vboxmanage startvm "$VM_NAME" --type headless
- name: Install TTU
shell: bash
run: |
curl -L 'https://downloads.teradata.com/download/cdn/tools/ttu/TeradataToolsAndUtilitiesBase__macosx_x86_64.17.10.11.00.tar.gz' \
-H 'Cookie: $TD_DOWNLOADS_MAGIC_COOKIE' --compressed -o ttu.tar.gz
tar -xzf ttu.tar.gz
installer -pkg ./TeradataToolsAndUtilitiesBase/*.pkg -target CurrentUserHomeDirectory
env:
TD_DOWNLOADS_MAGIC_COOKIE: ${{ secrets.TD_DOWNLOADS_MAGIC_COOKIE }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Verify Vantage Express is running
shell: bash
run: ./.github/workflows/scripts/verifyVantageIsRunning.sh
- name: Prepare database
shell: bash
run: |
curl -L 'https://downloads.teradata.com/download/cdn/extensibility/udf/md5-msg-digest/md5_20080530.zip' \
-H 'Cookie: $TD_DOWNLOADS_MAGIC_COOKIE' --compressed -o md5.zip
unzip md5.zip
cd ./md5/src
export PATH=$PATH:"/Users/runner/Library/Application Support/teradata/client/17.10/bin/"
# prepare bteq script
cat << EOF > /tmp/install_md5.bteq
.SET EXITONDELAY ON MAXREQTIME 20
.logon 127.0.0.1/dbc,dbc
CREATE DATABASE GLOBAL_FUNCTIONS AS PERMANENT = 60e6, SPOOL = 120e6;
GRANT CREATE FUNCTION ON GLOBAL_FUNCTIONS TO dbc;
DATABASE GLOBAL_FUNCTIONS;
.run file = hash_md5.btq
GRANT EXECUTE FUNCTION ON GLOBAL_FUNCTIONS TO dbc;
.logoff
EOF
bteq < /tmp/install_md5.bteq
- name: Run pytest tests
run: |
export DBT_TERADATA_UTILS_ROOT=$PWD
pytest test/integration
- uses: actions/upload-artifact@v2
if: ${{ failure() || cancelled() }}
with:
name: virtualbox-logs
path: /Users/runner/VirtualBox*