-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added nb tests to debug namerserver issue
- Loading branch information
Showing
5 changed files
with
199 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/dummy/itde.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c3c8450d-5ca8-4abe-8f7d-81644f4d33ee", | ||
"metadata": {}, | ||
"source": [ | ||
"## Setup\n", | ||
"### Open Secure Configuration Storage" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 21, | ||
"id": "cf0ee134-cfc4-46b5-99a0-563d269fae87", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "65fc4eb9da574801ad5b862198e24062", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"Output()" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "e7bcc8f6a2ea4cc886fa5b091e0d1739", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"Box(children=(Box(children=(Label(value='Configuration Store', layout=Layout(border_bottom='solid 1px', border…" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"%run ./utils/access_store_ui.ipynb\n", | ||
"display(get_access_store_ui('./'))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2bdf9910-791f-4aab-843f-8077c72f8931", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import requests\n", | ||
"requests.get(\"https://example.com/\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 22, | ||
"id": "d38a2a6f-1673-44cc-9a06-43afebc75749", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"172.20.0.2\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from exasol.nb_connector.ai_lab_config import AILabConfig\n", | ||
"hn = ai_lab_config.get(AILabConfig.db_host_name)\n", | ||
"print(hn)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 28, | ||
"id": "c330458d-8c59-4b34-a45c-27587dd21b8f", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[(1,)]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from exasol.nb_connector.connections import open_pyexasol_connection\n", | ||
"import textwrap\n", | ||
"\n", | ||
"with open_pyexasol_connection(ai_lab_config, compression=True, schema=ai_lab_config.db_schema,) as con:\n", | ||
" \n", | ||
" udf = textwrap.dedent('''\n", | ||
" CREATE OR REPLACE PYTHON3 SCALAR SCRIPT test_dns(dummy INTEGER)\n", | ||
" RETURNS INTEGER AS\n", | ||
" def run(ctx):\n", | ||
" import requests\n", | ||
" requests.get(\"https://example.com/\")\n", | ||
" return 1\n", | ||
" ''')\n", | ||
" con.execute(udf)\n", | ||
" \n", | ||
" result = con.execute(\"SELECT test_dns(1)\").fetchmany()\n", | ||
" print(result)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b435bbb2-8fdb-4b2e-998f-b9b4a330cdc9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "35014ec8-8de7-4689-957e-73a630740ad8", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
# We need to manually import all fixtures that we use, directly or indirectly, | ||
# since the pytest won't do this for us. | ||
from notebook_test_utils import (backend_setup, | ||
run_notebook) | ||
from exasol.pytest_backend import BACKEND_ONPREM | ||
|
||
|
||
|
||
def test_itde(backend, backend_setup) -> None: | ||
if backend != BACKEND_ONPREM: | ||
pytest.skip() | ||
current_dir = Path.cwd() | ||
store_path, store_password = backend_setup | ||
store_file = str(store_path) | ||
try: | ||
run_notebook('main_config.ipynb', store_file, store_password) | ||
os.chdir('./dummy') | ||
run_notebook('itde.ipynb', store_file, store_password) | ||
finally: | ||
os.chdir(current_dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters