Skip to content

Commit 424c297

Browse files
committed
added arg to show columns
1 parent 91c0bac commit 424c297

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ stackql_linux_amd64.zip
33
nohup.out
44
/.stackql
55
/pystackql
6+
test.log

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ This repository contains a set of tests for StackQL providers. It is intended to
55
## Usage
66

77
```bash
8-
test-provider.sh <provider_name> [<signed> <provider_path> <test_for_anonymous_cols>]
8+
test-provider.sh <provider_name> [<signed> <provider_path> <show_columns> <test_for_anonymous_cols>]
99
```
1010

1111
- `provider_name` - the name of the provider to test
1212
- `signed` - whether the provider is signed or not (default: false)
1313
- `provider_path` - the path to the provider (default: .)
14+
- `show_columns` - whether to show columns in output (default: false)
1415
- `test_for_anonymous_cols` - whether to test for anonymous columns (default: false)
1516

1617
## Example
@@ -31,16 +32,16 @@ true \
3132
```
3233

3334
```bash
34-
# test a local aws unsigned provider from another directory
35+
# test a local aws unsigned provider from another directory showing columns
3536
sh test-provider.sh \
3637
aws \
3738
false \
38-
/mnt/c/Users/javen/Documents/LocalGitRepos/stackql/local-registry
39+
/mnt/c/Users/javen/Documents/LocalGitRepos/stackql/local-registry \
40+
true
3941
```
4042

41-
4243
```bash
43-
# test a local azure unsigned provider from the current directory with anonymous column checks
44+
# test a local azure unsigned provider from the current directory showing columns
4445
sh test-provider.sh \
4546
azure \
4647
false \

test-provider.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
provider = sys.argv[1]
44

5+
showcols = None
6+
if len(sys.argv) > 2:
7+
showcols = sys.argv[2]
8+
9+
if showcols is not None:
10+
showcols = True
11+
else:
12+
showcols = False
13+
514
start_time = datetime.datetime.now()
615

716
import psycopg
@@ -72,6 +81,8 @@ def run_query(query):
7281
total_selectable_resources = total_selectable_resources + 1
7382
iql_desc_query = "DESCRIBE EXTENDED %s.%s.%s" % (provider, service, resource)
7483
desc = run_query(iql_desc_query)
84+
if showcols:
85+
print(desc)
7586
print("%s columns in %s.%s.%s" % (len(desc), provider, service, resource))
7687

7788
if len(methods.query("SQLVerb == 'INSERT'")) > 0:

test-provider.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
provider=$1
22
signed=$2
33
regpath=$3
4-
anoncolcheck=$4
4+
showcols=$4
5+
anoncolcheck=$5
56

67
if [ -z "$provider" ]; then
78
echo "provider (arg 1) must be set"
@@ -56,9 +57,9 @@ else
5657
echo "server is already running"
5758
fi
5859

59-
if [ -z "$anoncolcheck" ]; then
60+
if [ -z "$showcols" ]; then
6061
python3 test-provider.py $provider
6162
else
62-
# TODO implement anoncolcheck for server tests
63-
python3 test-provider.py $provider $anoncolcheck
63+
python3 test-provider.py $provider $showcols
64+
# TODO implement anoncolcheck for server tests
6465
fi

0 commit comments

Comments
 (0)