Skip to content

Commit

Permalink
Add script for installing TDVT
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Jan 17, 2024
1 parent a776fac commit 36dd6ce
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 14 deletions.
25 changes: 19 additions & 6 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,13 @@ You can run TDVT tests under Windows and macOS. This guide describes the setup f
### Initial Setup

* Create a new Exasol database running on port `8563`.
* Prepare database schema by running [tools/load_tvdt_test_data.sql](../../tools/load_tvdt_test_data.sql).
* Prepare database schema `TESTV1` by running [tools/load_tvdt_test_data.sql](../../tools/load_tvdt_test_data.sql).
* Configure hostname of the Exasol database: Add an entry to `C:\Windows\System32\Drivers\etc\hosts` (adapt the IP to your database):

```
10.0.0.2 exasol.example.com
```

* Install TDVT as described in the [TDVT documentation](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#set-up).
* Update the Exasol certificate fingerprint in the four `*.tds` files:
* [tdvt_jdbc/tds/cast_calcs.exasol_jdbc.tds](../../tdvt_jdbc/tds/cast_calcs.exasol_jdbc.tds)
* [tdvt_jdbc/tds/Staples.exasol_jdbc.tds](../../tdvt_jdbc/tds/Staples.exasol_jdbc.tds)
Expand All @@ -151,13 +150,25 @@ You can run TDVT tests under Windows and macOS. This guide describes the setup f
* [tdvt_odbc/config/tdvt/tdvt_override.ini](../../tdvt_odbc/config/tdvt/tdvt_override.ini)
* Ensure that directory `C:\Program Files\Tableau\Connectors\` does not contain any `.tabco` files as tests would use them instead of the sources.

#### Install TDVT

TDVT library must be installed in a Python virtual environment (venv). The [TDVT documentation](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#set-up) describes how to do this.

However we provide a script that automatically clones and installs TDVT into a new venv at `target/tdvt-venv`:

```sh
./tools/setup_tdvt.sh
```

Script `tools/run_tdvt_tests.sh` will automatically use this venv.

### Configure Test Suites

You can configure the tests suites to run in files
* [tdvt_jdbc/config/exasol_jdbc.ini](../../tdvt_jdbc/config/exasol_jdbc.ini)
* [tdvt_odbc/config/exasol_odbc.ini](../../tdvt_odbc/config/exasol_odbc.ini)
You can configure test suites to enable or disable tests using the following `.ini` files.
* JDBC: [tdvt_jdbc/config/exasol_jdbc.ini](../../tdvt_jdbc/config/exasol_jdbc.ini)
* ODBC: [tdvt_odbc/config/exasol_odbc.ini](../../tdvt_odbc/config/exasol_odbc.ini)

After modifying these files you need to re-generate the test suite by adding the `--generate` argument to the `tdvt.tdvt run` command.
After modifying these files you need to re-generate the test suite by adding the `--generate` argument to the `tdvt.tdvt run` command. Script `tools/run_tdvt_tests.sh` uses this option by default.

See the [manual](https://tableau.github.io/connector-plugin-sdk/docs/tdvt#ini-file-structure) for details about the available tests.

Expand All @@ -174,6 +185,7 @@ This will collect test results in `target/tdvt_results_jdbc/` resp. `target/tdvt
* JDBC Connector:

```sh
source target/tdvt-venv/Scripts/activate
cd tdvt_jdbc
python -m tdvt.tdvt run exasol_jdbc --generate
python -m tdvt.tdvt run exasol_jdbc
Expand All @@ -182,6 +194,7 @@ This will collect test results in `target/tdvt_results_jdbc/` resp. `target/tdvt
* ODBC Connector:

```sh
source target/tdvt-venv/Scripts/activate
cd tdvt_odbc
python -m tdvt.tdvt run exasol_odbc --generate
python -m tdvt.tdvt run exasol_odbc
Expand Down
10 changes: 4 additions & 6 deletions tools/package_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ set -euo pipefail

project_dir="$( cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )"
readonly project_dir
target_dir="$project_dir/target/"
readonly target_dir
sdk_dir="$target_dir/sdk"
readonly sdk_dir
packager_dir="$sdk_dir/connector-packager/"
readonly packager_dir
readonly target_dir="$project_dir/target/"
readonly sdk_dir="$target_dir/connector-plugin-sdk/"
readonly packager_dir="$sdk_dir/connector-packager/"


set_up_environment () {
clone_tableau_connector_plugin_sdk_repository
Expand Down
15 changes: 13 additions & 2 deletions tools/run_tdvt_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ set -euo pipefail

project_dir="$( cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )"
readonly project_dir
target_dir="$project_dir/target"
readonly target_dir
readonly target_dir="$project_dir/target"
readonly venv_dir="$target_dir/tdvt-venv"

skip_generate=false

activate_venv() {
if [ ! -d "$venv_dir" ]; then
echo "ERROR: Python venv not found at $venv_dir. Please run tools\setup_tdvt.sh"
exit 1
fi
echo "Activating venv at $venv_dir"
source "$venv_dir/Scripts/activate"
}

get_version() {
type="$1"
grep "plugin-version" < "$project_dir/src/exasol_$type/manifest.xml" | sed 's/^.*plugin-version="\([^"]*\)".*$/\1/'
Expand Down Expand Up @@ -43,6 +52,8 @@ run_tests () {
echo "Created test result archive $test_results_archive"
}

activate_venv

test_type=${1-}

if [[ -z "${test_type}" ]] ; then
Expand Down
35 changes: 35 additions & 0 deletions tools/setup_tdvt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail

project_dir="$( cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P )"
readonly project_dir
readonly target_dir="$project_dir/target"

readonly sdk_dir="$target_dir/connector-plugin-sdk"
readonly venv_dir="$target_dir/tdvt-venv"

if [ ! -d "$sdk_dir" ]; then
echo "Cloning Tableau Connector Plugin SDK repository to $sdk_dir..."
mkdir -p "$sdk_dir"
git clone https://github.com/tableau/connector-plugin-sdk.git "$sdk_dir"
else
echo "Tableau Connector Plugin SDK already exists at $sdk_dir, no need to clone it."
fi

echo "Deleting venv at $venv_dir..."
rm -rf "$venv_dir"

echo "Creating venv at $venv_dir..."
python -m venv "$venv_dir"
source "$venv_dir/Scripts/activate"

echo "Upgrading pip..."
python -m pip install --upgrade pip

echo "Install setuptools"
python -m pip install setuptools

echo "Installing TDVT..."
cd "$sdk_dir/tdvt"
python -m pip install -e .
python -m pip list

0 comments on commit 36dd6ce

Please sign in to comment.