Skip to content

Commit ca25444

Browse files
authored
Merge pull request #1040 from jrdnbradford/testing-updates
Local integration testing updates
2 parents 5415cc4 + fb1e106 commit ca25444

File tree

2 files changed

+51
-20
lines changed

2 files changed

+51
-20
lines changed

.github/integration-test.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,35 @@ def main():
226226
copy_parser.add_argument("src")
227227
copy_parser.add_argument("dest")
228228

229-
run_test_parser = subparsers.add_parser("run-test")
230-
run_test_parser.add_argument("--installer-args", action="append")
231-
run_test_parser.add_argument("--upgrade-from", default="")
232-
run_test_parser.add_argument("--bootstrap-pip-spec", default="/srv/src")
233-
run_test_parser.add_argument("container_name")
234-
run_test_parser.add_argument("test_files", nargs="+")
229+
run_test_parser = subparsers.add_parser(
230+
"run-test",
231+
help="Runs the bootstrap script in a container, then executes specified integration tests.",
232+
)
233+
run_test_parser.add_argument(
234+
"--installer-args",
235+
action="append",
236+
default=[],
237+
help="Additional arguments to pass to bootstrap.py during the main installation. Can be used multiple times.",
238+
)
239+
run_test_parser.add_argument(
240+
"--upgrade-from",
241+
default="",
242+
help="A version/tag (e.g., 'main', 'v0.1.0') to install first, simulating an upgrade to the current source code.",
243+
)
244+
run_test_parser.add_argument(
245+
"--bootstrap-pip-spec",
246+
default="/srv/src",
247+
help="The pip specification used by the bootstrap script to install TLJH (for example: '--bootstrap-pip-spec=git+https://github.com/your-username/the-littlest-jupyterhub.git@branch-name'). Defaults to the local source code path.",
248+
)
249+
run_test_parser.add_argument(
250+
"container_name",
251+
help="An identifier for the container/test run (for example: 'basic-tests').",
252+
)
253+
run_test_parser.add_argument(
254+
"test_files",
255+
nargs="+",
256+
help="A list of one or more test files under 'integration-tests/' to be executed.",
257+
)
235258

236259
show_logs_parser = subparsers.add_parser("show-logs")
237260
show_logs_parser.add_argument("container_name")

docs/contributing/tests.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,43 @@ against the same installation of TLJH.
2828

2929
### Running integration tests locally
3030

31-
You need `docker` installed and callable by the user running
32-
the integration tests without needing sudo.
31+
You need `docker` or `podman` installed and callable by the user
32+
running the integration tests without needing sudo.
3333

34-
You can then run the tests with:
34+
First build the container with a Ubuntu-based image:
3535

3636
```bash
37-
.github/integration-test.py run-test <name-of-run> <test-file-names>
37+
.github/integration-test.py build-image \
38+
--build-arg "BASE_IMAGE=ubuntu:22.04"
3839
```
3940

40-
- `<name-of-run>` is an identifier for the tests - you can choose anything you want
41-
- `<test-file-names>>` is list of test files (under `integration-tests`) that should be run in one go.
41+
Then you can then run the tests with the `run-test` function. For usage run:
42+
43+
```bash
44+
.github/integration-test.py run-test --help
45+
```
4246

4347
For example, to run all the basic tests, you would write:
4448

4549
```bash
4650
.github/integration-test.py run-test basic-tests \
47-
test_hub.py \
48-
test_proxy.py \
49-
test_install.py \
50-
test_extensions.py
51+
test_hub.py \
52+
test_proxy.py \
53+
test_install.py \
54+
test_extensions.py
5155
```
5256

53-
This will run the tests in the three files against the same installation
57+
This will run the tests in the four files against the same installation
5458
of TLJH and report errors.
5559

56-
If you would like to run the tests with a custom pip spec for the bootstrap script, you can use the `--bootstrap-pip-spec`
60+
If you would like to run the tests with a custom `pip` spec for the bootstrap script, you can use the `--bootstrap-pip-spec`
5761
parameter:
5862

5963
```bash
60-
.github/integration-test.py run-test <name-of-run> <test-file-names> \
61-
--bootstrap-pip-spec="git+https://github.com/your-username/the-littlest-jupyterhub.git@branch-name"
64+
.github/integration-test.py run-test custom-pip-spec \
65+
test_hub.py \
66+
test_proxy.py \
67+
test_install.py \
68+
test_extensions.py \
69+
--bootstrap-pip-spec="git+https://github.com/your-username/the-littlest-jupyterhub.git@branch-name"
6270
```

0 commit comments

Comments
 (0)