Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaitre314 committed Jul 14, 2024
1 parent 0c4aa08 commit 2dbf249
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/CloudTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ jobs:
az login --service-principal -u ${{secrets.AZURE_CLIENT_ID}} -p ${{secrets.AZURE_CLIENT_SECRET}} --tenant ${{secrets.AZURE_TENANT_ID}}
python3 duckdb/scripts/run_tests_one_by_one.py ./build/release/test/unittest "*test/sql/cloud/*"
- name: Test with access token
env:
AZURE_STORAGE_ACCOUNT: ${{secrets.AZURE_STORAGE_ACCOUNT}}
run: |
az login --service-principal -u ${{secrets.AZURE_CLIENT_ID}} -p ${{secrets.AZURE_CLIENT_SECRET}} --tenant ${{secrets.AZURE_TENANT_ID}}
export AZURE_ACCESS_TOKEN=`az account get-access-token --resource https://storage.azure.com --query accessToken --output tsv`
python3 duckdb/scripts/run_tests_one_by_one.py ./build/release/test/unittest "*test/sql/cloud/*"
- name: Log out azure-cli
if: always()
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CREATE SECRET secret4 (
ACCOUNT_NAME '⟨storage account name⟩'
);
```
- Unauthenticated
- Anonymous
```sql
CREATE SECRET secret5 (
TYPE AZURE,
Expand Down
42 changes: 42 additions & 0 deletions test/sql/cloud/access_token_auth.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# name: test/sql/cloud/access_token_auth.test
# description: test access-token authentication
# group: [azure]

require azure

require parquet

require-env AZURE_ACCESS_TOKEN

require-env AZURE_STORAGE_ACCOUNT

statement ok
set allow_persistent_secrets=false

statement error
SELECT count(*) FROM 'azure://testing-private/l.parquet';
----
Invalid Input Error: No valid Azure credentials found!

statement ok
CREATE SECRET az1 (
TYPE AZURE,
PROVIDER ACCESS_TOKEN,
ACCESS_TOKEN '${AZURE_ACCESS_TOKEN}',
ACCOUNT_NAME '${AZURE_STORAGE_ACCOUNT}'
)

query I
SELECT count(*) FROM 'azure://testing-private/l.parquet';
----
60175

query I
SELECT count(*) FROM 'abfss://testing-private/l.parquet';
----
60175

query I
FROM glob('az://testing-private/*.parquet');
----
az://testing-private/l.parquet

0 comments on commit 2dbf249

Please sign in to comment.