Skip to content

Commit 561487d

Browse files
remove devtools and create a separate JIRA in backlog
1 parent 5d39197 commit 561487d

9 files changed

Lines changed: 83 additions & 210 deletions

File tree

TESTING.md

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ pip install pre-commit && pre-commit install
1313
1414
---
1515

16-
## What to run
16+
## What to run locally vs in CI
1717

1818
```
1919
unit tests → core-local → open PR → CI handles the rest
2020
```
2121

22-
| Suite | Command | Needs | Time |
23-
|-------|---------|-------|------|
24-
| Unit | `tox` | nothing | ~2 min |
25-
| Core — local | `tox -c test/core/tox.ini -e core-local` | nothing | ~1 hr |
26-
| Core — GCS | `tox -c test/core/tox.ini -e core-gcs` | devtools `fake-gcs-server` | ~1 hr |
27-
| Core — Azure | `tox -c test/core/tox.ini -e core-azure` | devtools `azurite` | ~1 hr |
28-
| Core — Batch/K8s/Argo/SFN | `tox -c test/core/tox.ini -e core-<name>` | full devstack | 2–3 hr |
29-
| UX — local | `tox -e ux-local` | nothing | ~30 min |
30-
| UX — cloud | `tox -e ux-<name>` | full devstack | ~1 hr |
22+
| Suite | Command | Needs | Run where |
23+
|-------|---------|-------|-----------|
24+
| Unit | `tox` | nothing | locally + CI |
25+
| Core — local | `tox -c test/core/tox.ini -e core-local` | nothing | locally + CI |
26+
| Core — GCS / Azure | `tox -c test/core/tox.ini -e core-{gcs,azure}` | emulator at known port | **CI** |
27+
| Core — Batch/K8s/Argo/SFN | `tox -c test/core/tox.ini -e core-<name>` | full devstack | **CI** |
28+
| UX — local | `tox -e ux-local` | nothing | locally + CI |
29+
| UX — cloud | `tox -e ux-<name>` | full devstack | **CI** |
3130

32-
Run **unit + core-local** before every PR. Cloud-backend tests (`core-gcs`,
33-
`core-batch`, …) are only needed if you changed that backend's storage code —
34-
otherwise let CI run them.
31+
Run **unit + core-local** before every PR. All cloud-backend tests require
32+
infrastructure that CI provisions — there is no need to set up emulators or
33+
Docker containers locally. Open your PR and let CI handle them.
3534

3635
---
3736

@@ -54,7 +53,7 @@ flow definition (~64 classes), runs it as a subprocess, and verifies results
5453
in-process. This yields ~470 parametrised items per backend, identified as
5554
`backend/graph/FlowDefinition/executor`.
5655

57-
### core-local
56+
### core-local — run this locally
5857

5958
```bash
6059
tox -c test/core/tox.ini -e core-local
@@ -65,40 +64,22 @@ tox -c test/core/tox.ini -e core-local -- --core-graphs simple-foreach
6564
tox -c test/core/tox.ini -e core-local -- -n auto # parallel
6665
```
6766

68-
### core-gcs / core-azure (cloud storage emulators)
67+
### core-gcs / core-azure / core-batch / core-k8s / core-argo / core-sfn — let CI run these
6968

70-
Only needed when you changed GCS or Azure storage code. The emulators are
71-
part of the devtools stack:
69+
These backends require external infrastructure (GCS emulator, Azure emulator,
70+
MinIO, Kubernetes, …). CI provisions all of it automatically. You do not need
71+
to install Docker or start any services to get these tests to pass.
7272

73-
```bash
74-
cd devtools
75-
SERVICES_OVERRIDE=fake-gcs-server make up # GCS (port 4443)
76-
SERVICES_OVERRIDE=azurite make up # Azure (port 10000)
77-
```
78-
79-
Then:
80-
81-
```bash
82-
tox -c test/core/tox.ini -e core-gcs
83-
tox -c test/core/tox.ini -e core-azure
84-
```
85-
86-
### core-batch / core-k8s / core-argo / core-sfn
87-
88-
These require the full devstack. For most PRs, **let CI run them**. If you
89-
need to debug a scheduler-specific failure locally, start only the services
90-
that backend needs, then run the env:
73+
If you are debugging a specific backend failure locally and already have the
74+
required infrastructure running, you can invoke the env directly:
9175

9276
```bash
93-
# Required services per backend:
94-
# core-batch: minio, postgresql, metadata-service, localbatch
95-
# core-k8s: minio, postgresql, metadata-service
96-
# core-argo: minio, postgresql, metadata-service, argo-workflows
97-
# core-sfn: minio, postgresql, metadata-service, localbatch, ddb-local, sfn-local
98-
cd devtools && SERVICES_OVERRIDE=minio,postgresql,metadata-service,localbatch make up
77+
tox -c test/core/tox.ini -e core-gcs # expects fake-gcs-server at localhost:4443
78+
tox -c test/core/tox.ini -e core-azure # expects azurite at localhost:10000
79+
tox -c test/core/tox.ini -e core-batch # expects devstack (see devtools/README.md)
9980
```
10081

101-
See `devtools/README.md` for the full devstack reference.
82+
For devstack setup see `devtools/README.md`.
10283

10384
---
10485

@@ -118,7 +99,5 @@ pre-commit run --all-files # all checks
11899
| `tox: command not found` | `pip install tox` |
119100
| `Username 'root' is not allowed` | `export METAFLOW_USER=tester` |
120101
| `ModuleNotFoundError` during collection | `rm -rf .tox && tox -c test/core/tox.ini -e core-local` |
121-
| `core-gcs``ConnectionRefusedError` | `cd devtools && SERVICES_OVERRIDE=fake-gcs-server make up` |
122-
| `core-azure` — Azure connection error | `cd devtools && SERVICES_OVERRIDE=azurite make up` |
123-
| `core-batch/k8s` — metadata service error | Start devstack: `cd devtools && make up` |
124-
| Tests run slowly | `tox -c test/core/tox.ini -e core-local -- -n auto` (don't use `-n` for cloud envs) |
102+
| `core-local` slow | `tox -c test/core/tox.ini -e core-local -- -n auto` |
103+
| Cloud env fails locally | Check that the required emulator/devstack is running — or just open a PR and let CI handle it |

devtools/Tiltfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ components = {
3030
"ddb-local": [],
3131
"sfn-local": ["ddb-local"],
3232
"airflow": ["postgresql"],
33-
"fake-gcs-server": [],
3433
}
3534

3635
# ---------------------------------------------------------------------------
@@ -94,7 +93,6 @@ load('./tilt/localbatch.tiltfile', 'setup_localbatch')
9493
load('./tilt/ddb_local.tiltfile', 'setup_ddb_local')
9594
load('./tilt/sfn_local.tiltfile', 'setup_sfn_local')
9695
load('./tilt/airflow.tiltfile', 'setup_airflow')
97-
load('./tilt/fake_gcs_server.tiltfile', 'setup_fake_gcs_server')
9896

9997
_SETUP = {
10098
"minio": setup_minio,
@@ -106,7 +104,6 @@ _SETUP = {
106104
"ddb-local": setup_ddb_local,
107105
"sfn-local": setup_sfn_local,
108106
"airflow": setup_airflow,
109-
"fake-gcs-server": setup_fake_gcs_server,
110107
}
111108

112109
# ---------------------------------------------------------------------------

devtools/pick_services.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ SERVICE_OPTIONS=(
2121
"ddb-local"
2222
"sfn-local"
2323
"airflow"
24-
"fake-gcs-server"
2524
)
2625

2726
gum style "$LOGO" \

devtools/tilt/fake_gcs_server.tiltfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

devtools/tilt/k8s/fake-gcs-secret.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

devtools/tilt/k8s/fake-gcs-server.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

devtools/tilt/k8s/gcs-bucket-init-job.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/core/conftest.py

Lines changed: 57 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -87,72 +87,65 @@ def pytest_generate_tests(metafunc: Any) -> None:
8787
if "flow_triple" not in metafunc.fixturenames:
8888
return
8989

90-
try:
91-
ok_tests_raw = metafunc.config.getoption("--core-tests", default=None)
92-
ok_graphs_raw = metafunc.config.getoption("--core-graphs", default=None)
93-
ok_tests = (
94-
{t.lower() for t in ok_tests_raw.split(",") if t} if ok_tests_raw else set()
95-
)
96-
ok_graphs = (
97-
{g.lower() for g in ok_graphs_raw.split(",") if g} if ok_graphs_raw else set()
98-
)
99-
100-
# All context configuration comes from the environment (set by tox setenv).
101-
marker_name = os.environ.get("METAFLOW_CORE_MARKER", "local")
102-
executors = [
103-
e for e in os.environ.get("METAFLOW_CORE_EXECUTORS", "cli,api").split(",") if e
104-
]
105-
disabled_tests = {
106-
t for t in os.environ.get("METAFLOW_CORE_DISABLED_TESTS", "").split(",") if t
107-
}
108-
enabled_tests = {
109-
t for t in os.environ.get("METAFLOW_CORE_ENABLED_TESTS", "").split(",") if t
110-
}
111-
disable_parallel = os.environ.get("METAFLOW_CORE_DISABLE_PARALLEL", "") == "1"
112-
113-
mark = getattr(pytest.mark, marker_name)
114-
all_tests = sorted(_iter_tests(), key=lambda t: t.PRIORITY)
115-
all_graphs = list(_iter_graphs())
116-
117-
params = []
118-
for graph in all_graphs:
119-
if ok_graphs and graph["name"].lower() not in ok_graphs:
90+
ok_tests_raw = metafunc.config.getoption("--core-tests", default=None)
91+
ok_graphs_raw = metafunc.config.getoption("--core-graphs", default=None)
92+
ok_tests = (
93+
{t.lower() for t in ok_tests_raw.split(",") if t} if ok_tests_raw else set()
94+
)
95+
ok_graphs = (
96+
{g.lower() for g in ok_graphs_raw.split(",") if g} if ok_graphs_raw else set()
97+
)
98+
99+
# All context configuration comes from the environment (set by tox setenv).
100+
marker_name = os.environ.get("METAFLOW_CORE_MARKER", "local")
101+
executors = [
102+
e for e in os.environ.get("METAFLOW_CORE_EXECUTORS", "cli,api").split(",") if e
103+
]
104+
disabled_tests = {
105+
t for t in os.environ.get("METAFLOW_CORE_DISABLED_TESTS", "").split(",") if t
106+
}
107+
enabled_tests = {
108+
t for t in os.environ.get("METAFLOW_CORE_ENABLED_TESTS", "").split(",") if t
109+
}
110+
disable_parallel = os.environ.get("METAFLOW_CORE_DISABLE_PARALLEL", "") == "1"
111+
112+
mark = getattr(pytest.mark, marker_name)
113+
all_tests = sorted(_iter_tests(), key=lambda t: t.PRIORITY)
114+
all_graphs = list(_iter_graphs())
115+
116+
params = []
117+
for graph in all_graphs:
118+
if ok_graphs and graph["name"].lower() not in ok_graphs:
119+
continue
120+
if disable_parallel and any(
121+
"num_parallel" in node for node in graph["graph"].values()
122+
):
123+
continue
124+
125+
for test in all_tests:
126+
test_name = test.__class__.__name__
127+
if ok_tests and test_name.lower() not in ok_tests:
128+
continue
129+
if test_name in disabled_tests:
120130
continue
121-
if disable_parallel and any(
122-
"num_parallel" in node for node in graph["graph"].values()
123-
):
131+
if enabled_tests and test_name not in enabled_tests:
132+
continue
133+
if not FlowFormatter(graph, test).valid:
124134
continue
125135

126-
for test in all_tests:
127-
test_name = test.__class__.__name__
128-
if ok_tests and test_name.lower() not in ok_tests:
129-
continue
130-
if test_name in disabled_tests:
131-
continue
132-
if enabled_tests and test_name not in enabled_tests:
133-
continue
134-
if not FlowFormatter(graph, test).valid:
135-
continue
136-
137-
for executor in executors:
138-
param_id = "%s/%s/%s/%s" % (
139-
marker_name,
140-
graph["name"],
141-
test_name,
142-
executor,
143-
)
144-
params.append(
145-
pytest.param(
146-
(graph, test, executor),
147-
marks=[mark],
148-
id=param_id,
149-
)
136+
for executor in executors:
137+
param_id = "%s/%s/%s/%s" % (
138+
marker_name,
139+
graph["name"],
140+
test_name,
141+
executor,
142+
)
143+
params.append(
144+
pytest.param(
145+
(graph, test, executor),
146+
marks=[mark],
147+
id=param_id,
150148
)
149+
)
151150

152-
metafunc.parametrize("flow_triple", params)
153-
except Exception as e:
154-
import traceback
155-
156-
print("Warning: could not generate core test combinations: %s" % e)
157-
traceback.print_exc()
158-
metafunc.parametrize("flow_triple", [])
151+
metafunc.parametrize("flow_triple", params)

test/core/metaflow_test/formatter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def _flow_lines(self):
109109
"from metaflow_test import is_resumed, ResumeFromHere, "
110110
"TestRetry, try_to_get_card"
111111
)
112+
yield 0, "import pytest"
112113
if tags:
113114
yield 0, "from metaflow import %s" % ",".join(tags)
114115

0 commit comments

Comments
 (0)