Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more testing coverage for L0 (multiple requests, email server) #9306

Merged
merged 29 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9421f82
Cherry-pick 6cdae719e711f537e720ca69528a5352797c2de4
BrendanSchell Sep 19, 2024
54dd7a9
email server landing
snwagh Sep 18, 2024
63ff65f
More changes to cherry-pick email branch in
BrendanSchell Sep 19, 2024
55d4d62
some initial changes to submit multiple jobs
BrendanSchell Sep 19, 2024
4de268a
make l0 notebooks more consistent with l2
BrendanSchell Sep 20, 2024
f2e1f29
some adjustments to event loop handling in email_helpers
BrendanSchell Sep 20, 2024
586a797
a bunch of small fixes and adding multiple jobs to l0
BrendanSchell Sep 20, 2024
2df0755
Revert "some adjustments to event loop handling in email_helpers"
BrendanSchell Sep 23, 2024
600cf6e
revert to single smtp server and some fixes
BrendanSchell Sep 23, 2024
dbab511
fixing smtp bug
snwagh Sep 23, 2024
98f07d9
fixing smtp bug
snwagh Sep 23, 2024
86279db
disable uvicorn hotreload
yashgorana Sep 23, 2024
d827fc4
add nb logger for debugging
yashgorana Sep 23, 2024
b1ec044
separate email json files with lock
yashgorana Sep 23, 2024
1083a6d
simplify smtp server class and add del
BrendanSchell Sep 24, 2024
23d8d14
get_email_server raise on multiple timeouts
BrendanSchell Sep 24, 2024
6ce67fa
Revert "disable uvicorn hotreload"
BrendanSchell Sep 24, 2024
3920009
tunshell into scenario
BrendanSchell Sep 24, 2024
d31a611
add back nosec to unbound port in email_helpers
BrendanSchell Sep 24, 2024
c4a07aa
switch tunshell
BrendanSchell Sep 24, 2024
137d7a5
Removing high side notification setting
snwagh Sep 24, 2024
a45b6eb
adding notebooks checks for email server
snwagh Sep 24, 2024
31669c6
remove tunshell and mac os from scenario sync :(
BrendanSchell Sep 24, 2024
536d603
Adding high side emailing to the same server back
snwagh Sep 24, 2024
711e986
tunshell
BrendanSchell Sep 24, 2024
cef12a1
fix devspace profile passthrough for highlow
BrendanSchell Sep 25, 2024
811852a
revert CI changes for tunshell
BrendanSchell Sep 25, 2024
fbedd17
Merge branch 'dev' into bschell/l0-add-more-testing-coverage
snwagh Sep 25, 2024
e1ce835
Notebook cleanup!
BrendanSchell Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pr-tests-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,10 @@ jobs:
max-parallel: 99
matrix:
# Disable on windows until its flakyness is reduced.
# Also disable on macos for now since SMTP server
# fails to write to emails.json in CI runner.
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
python-version: ["3.12"]
deployment-type: ["python"]
bump-version: ["False"]
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ packages/grid/helm/examples/dev/migration.yaml
# dynaconf settings file
**/settings.yaml


# Any temporary material created for scenarios
notebooks/scenarios/bigquery/*.json

notebooks/scenarios/bigquery/sync/*.json
notebooks/scenarios/bigquery/sync/*.json.lock
notebooks/tutorials/version-upgrades/*.yaml
notebooks/tutorials/version-upgrades/*.blob
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# stdlib\n",
"from os import environ as env\n",
"\n",
"# syft absolute\n",
"import syft as sy\n",
"from syft.util.test_helpers.email_helpers import get_email_server"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# stdlib\n",
"environment = env.get(\"ORCHESTRA_DEPLOYMENT_TYPE\", \"python\")\n",
"high_port = env.get(\"CLUSTER_HTTP_PORT_HIGH\", \"9081\")\n",
"low_port = env.get(\"CLUSTER_HTTP_PORT_LOW\", \"9083\")\n",
"print(environment, high_port, low_port)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# when in k8s these are the default values\n",
"ROOT_EMAIL = \"[email protected]\"\n",
"ROOT_PASSWORD = \"bqpw\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# in case we are not in k8s we set them here for orchestra to use\n",
"env[\"DEFAULT_ROOT_EMAIL\"] = ROOT_EMAIL\n",
"env[\"DEFAULT_ROOT_PASSWORD\"] = ROOT_PASSWORD"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"server_low = sy.orchestra.launch(\n",
" name=\"bigquery-low\",\n",
" server_side_type=\"low\",\n",
" dev_mode=True,\n",
" reset=True,\n",
" n_consumers=1,\n",
" create_producer=True,\n",
" port=low_port,\n",
")\n",
"\n",
"server_high = sy.orchestra.launch(\n",
" name=\"bigquery-high\",\n",
" server_side_type=\"high\",\n",
" dev_mode=True,\n",
" reset=True,\n",
" n_consumers=1,\n",
" create_producer=True,\n",
" port=high_port,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"email_server, smtp_server = get_email_server(reset=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"root_client_low = sy.login(\n",
" url=f\"http://localhost:{low_port}\", email=ROOT_EMAIL, password=ROOT_PASSWORD\n",
")\n",
"root_client_high = sy.login(\n",
" url=f\"http://localhost:{high_port}\", email=ROOT_EMAIL, password=ROOT_PASSWORD\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create new admin client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ADMIN_EMAIL, ADMIN_PW = \"[email protected]\", \"bqpw2\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create admin account on low side\n",
"root_client_low.register(\n",
" name=\"second admin\", email=ADMIN_EMAIL, password=ADMIN_PW, password_verify=ADMIN_PW\n",
")\n",
"# update role\n",
"new_user_id = root_client_low.users.search(email=ADMIN_EMAIL)[0].id\n",
"root_client_low.users.update(uid=new_user_id, role=\"admin\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# create admin account on high side\n",
"root_client_high.register(\n",
" name=\"second admin\", email=ADMIN_EMAIL, password=ADMIN_PW, password_verify=ADMIN_PW\n",
")\n",
"# update role\n",
"new_user_id = root_client_high.users.search(email=ADMIN_EMAIL)[0].id\n",
"root_client_high.users.update(uid=new_user_id, role=\"admin\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# We cannot delete the root client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"low_client = sy.login(\n",
" url=f\"http://localhost:{low_port}\", email=ADMIN_EMAIL, password=ADMIN_PW\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"root_admin_id = low_client.users.search(email=ROOT_EMAIL)[0].id"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with sy.raises(sy.SyftException):\n",
" low_client.users.delete(root_admin_id)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create ephemeral admin and delete it"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# register 2nd new admin (to delete)\n",
"user_email, user_pw = \"[email protected]\", \"bqpw3\"\n",
"## create\n",
"root_client_low.register(\n",
" name=\"x\", email=user_email, password=user_pw, password_verify=user_pw\n",
")\n",
"## update role\n",
"new_user_id2 = root_client_low.users.search(email=user_email)[0].id\n",
"root_client_low.users.update(uid=new_user_id2, role=\"admin\")\n",
"\n",
"# delete\n",
"root_client_low.users.delete(new_user_id2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cleanup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if environment != \"remote\":\n",
" server_high.land()\n",
" server_low.land()\n",
"smtp_server.stop()"
]
}
],
"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.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading
Loading