34 Commits
Author SHA1 Message Date
John Chilton afb0768220 Share the Kubernetes PV/PVC setup between integration test classes
TestKubernetesNativeInteractiveToolsIntegration copied TestKubernetesIntegration's
volume/claim setup and tearDownClass verbatim, differing only in three name strings.
Extract KubernetesVolumesMixin so the next Kubernetes test class inherits it instead
of copying it a third time.

The mixin's claim_prefix also replaces job_config()'s jobs_directory_claim and
tool_directory_claim parameters - one name for the pair, and the job config can no
longer name claims the class did not create. Generated job_conf XML is unchanged for
both prefixes.

Also reuse what test_kubernetes_runner.py already exports:

- ingress_for_tool() moves there beside the other cluster helpers, and both it and
  the two "kubectl get job -o json" call sites go through a new kubectl_get().
- The interactive tools case uses KubernetesDatasetPopulator, which dumps
  "kubectl describe nodes" when a history wait fails.
2026-09-03 14:59:40 -04:00
mvdbeek 337a035fb5 Cover interactive tools on the native Kubernetes runner
``TestKubeInteractiveToolsRemoteProxyIntegration`` runs interactive tools
on Kubernetes through Pulsar, so it never exercises
``KubernetesJobRunner``. It is also skipped in CI - it needs an
externally started gx-it-proxy to fetch the tool's content over HTTP.
Between the two, nothing was checking the runner's own interactive tool
support, which is how #23203 shipped broken.

The runner configures the entry points and creates the service and
ingress while submitting the job, before any proxy is involved, so
asserting on the entry point and on the ingress it created needs no
proxy and runs wherever a cluster is available.

Split the shared helpers out of
``AbstractTestCases.BaseInteractiveToolsIntegrationTestCase`` into
``BaseInteractiveToolsTestCase`` so a test case can reuse them without
inheriting the two tests that require a proxy. Existing cases keep
inheriting both. ``job_config()`` grows claim name arguments, defaulting
to today's values, so the new case gets its own volume claims instead of
racing ``TestKubernetesIntegration`` for them across test shards.
2026-07-31 09:35:03 +02:00
paperbenni bec3d3ad9c Drop support for Python 3.8
Drop Python 3.8 support in 5 Pulsar-compatible packages
(job_metrics, tool_util, tool_util_models, util, objectstore)
and run pyupgrade --py310-plus on their source code.

- Bump requires-python from >=3.8 to >=3.10 in all 5 packages
- Remove Python 3.8 and 3.9 classifiers
- Remove ruff per-file-ignores for UP rules on these paths
- Remove backports.zoneinfo conditional dependency
- Remove pydyf<0.11 pin from conditional-requirements.txt
- Update Makefile pyupgrade target (remove PY38_PYUPGRADE_PATHS)
- Update CI workflow to test with Python 3.10 instead of 3.8

Clean up unused deprecated typing imports after pyupgrade

Remove now-unused typing imports (Dict, List, Optional, Set, Tuple,
Type, Union) that became dead after pyupgrade --py310-plus converted
annotations to use built-in types and | syntax.

Also run ruff check --fix --select=UP007,UP045 across the entire
codebase to convert remaining Optional[X] -> X | None and
Union[X, Y] -> X | Y patterns.

Enable ruff UP007/UP045 for Python 3.10 union syntax

Remove UP007 (Union[X,Y] -> X | Y) and UP045 (Optional[X] -> X | None)
from the ruff ignore list and convert all type aliases across the
codebase. These rules were deferred while Python 3.9 was supported;
requires-python is now >=3.10.

A custom script was used because neither ruff --fix nor
pyupgrade --py310-plus converts Optional[X]/Union[X,Y] in type alias
positions (e.g. X = Union[A, B]) — they only handle annotation
positions (e.g. def f(x: Optional[int])). All 167 violations were
module-level type aliases. A few edge cases were fixed manually:
single-element Union[X,], typing.Union qualified refs, runtime
Optional[type] calls, and Annotated[Optional[...]] pydantic fields.

Fix UP007 autofix regression with string forward reference type aliases

Commit fa6bd955a0 enabled ruff UP007/UP045 and auto-fixed
module-level type aliases using Union with string forward
references, producing invalid 'str | str' expressions.

This was a known ruff bug (charliermarsh/ruff#826) that has since
been fixed in later ruff versions, but this codebase was
converted before the fix was in place.

Revert to Union syntax and restore TYPE_CHECKING imports that
ruff's TCH rule cleaned up as a side effect when it thought the
forward references were unused.
2026-06-25 15:12:05 +01:00
mvdbeek 77d953c628 Move more setup code into handle_galaxy_config_kwds which has test_driver configured 2026-01-01 15:08:26 +01:00
mvdbeek 415e5feb58 Use test_driver.mkdtemp systematically
This might help with integration tests filling up the disk.
This was mostly fine before but this is a nice abstraction.
2026-01-01 15:08:26 +01:00
Nicola Soranzo 7f89e0eab9 Code cleanups from pyupgrade
Found by running:

```
make pyupgrade
ruff check --fix .
ruff check --preview --unsafe-fixes --select=F401 --fix .
make format
make update-client-api-schema
```

The bulk of the changes are replacements of typing deprecated aliases
such as `Dict` and `List` with the standard library classes. These
aliases became redundant in Python 3.9 when the corresponding
pre-existing classes were enhanced to support `[]`, see
https://docs.python.org/3/library/typing.html#deprecated-aliases

Also:
- Update the `pyupgrade` Makefile target to use `--py38-plus` for the
  packages needed by Pulsar, including the new galaxy-tool-util-models
  package.
2025-07-31 11:17:22 +01:00
Nicola Soranzo 8cdca0f343 Revert some requests import changes
introduced in https://github.com/galaxyproject/galaxy/pull/18003 .
In particular, when using requests in the tests to connect to Galaxy
or the ToolShed it's not needed to use the modified headers.

Also:
- Move some imports after conditional imports.
- Fix type annotations in `lib/tool_shed/test/base/populators.py`
- Fix typo bug in `test/unit/util/test_get_url.py`
2024-05-23 15:55:56 +01:00
mvdbeek e8a3b8c0cd Create wrapper for requests with default user agent 2024-04-16 17:54:29 +02:00
Nicola Soranzo e975ca3754 Update to black 2024 stable style 2024-01-30 18:09:51 +00:00
Sveinung Gundersen bf422d3474 Removed "interactivetools_shorten_url" 2023-11-15 12:54:14 +01:00
Martin Cech 36da2067ce Merge branch 'release_22.05' into dev 2023-01-03 13:13:53 -08:00
Lain Pavot cdbfe6787b Fixes #15224 - tools token are created with a size of 10 chars when interactivetools_shorten_url is true 2023-01-03 09:37:18 +01:00
Nicola Soranzo 4a7e25e665 Use `history_id` fixture instead of instance attribute. More type annotations 2022-11-23 04:04:51 +00:00
John Chilton 5a3069d283 Pulsar infrastructure improvements for TES execution and MQ-less Kubernetes.
Updating the Pulsar job runner/client for https://github.com/galaxyproject/pulsar/pull/302 and as described in the new docs at https://pulsar.readthedocs.io/en/latest/containers.html.
2022-10-16 09:56:58 +02:00
Nicola Soranzo c35d8f2a06 Replace `unittest.TestCase` with pytest-based partial re-implementation
Also:
- Rename `FooBarTestCase` test classes as `TestFooBar`. These were collected
  by pytest only because they were `unittest.TestCase` derived, but normally
  pytest collects only test classes whose name starts with `Test`, see
  https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-python_classes
2022-09-27 03:34:58 +01:00
Nicola Soranzo 3091737ab9 Misc test fixes 2022-09-27 03:34:55 +01:00
mvdbeek 9277af6657 Raise exception when waiting for entry point
There's a retry loop, I suppose it was meant to be used that way.
2022-03-15 21:32:00 +01:00
mvdbeek b39e8ad9a2 First pass in dropping uwsgi specific things 2022-03-15 21:31:59 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
Nicola Soranzo 6a6abf37ef Split run_tool_raw() out of BaseDatasetPopulator.run_tool()
so that the former always returns a `Response` object while the latter
returns the response content.

Also:
- In `CwlPopulator.run_cwl_job()` wait for the run only if `assert_ok`
  is True; if the `wait()` call fails, summarize history also for
  workflow runs.
2021-11-27 03:14:52 +00:00
mvdbeek 2552ab47f1 Use f-strings in forward-merged code 2021-05-11 18:09:53 +02:00
mvdbeek 41aca51d2b Merge branch 'release_20.09' into release_21.01 2021-05-11 18:01:46 +02:00
Marius van den BeekandNicola Soranzo 8acf0d16a8 Use different string formatting option
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2021-05-11 14:57:21 +02:00
Marius van den BeekandNicola Soranzo d69a79f29e Use generator expression instead of list comprehension
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2021-05-11 14:56:50 +02:00
mvdbeek 75f5877951 Log exceptions IT port monitor fails and stop job
That should make it significantly easier to debug issues when the
container monitor dies unexpectedly (which I sort of expect in the
future given that we parse output from the docker CLI).
2021-05-10 17:43:46 +02:00
mvdbeek 5fa02d8f7a Add testcase and move stop operation into API 2020-12-12 11:26:09 +01:00
Nicola Soranzo 9d74bba7fb Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` .

Manually drop several `six` imports.

Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
2020-10-07 11:52:13 +01:00
John Chilton 52bd3ad966 Return to skipping Kubernetes staging tests on Github actions...
... still working out some kind of issue with these.
2020-04-23 12:12:51 -04:00
John Chilton a0d108b844 Outline a test of kubernetes staging + interactive tool. 2020-04-23 12:12:50 -04:00
John Chilton 52c00cacbb Integration test for GxITs against remote proxies.
Instructions for setting up external goodies documented in docstring.

Small tweaks included:
 - Allow serving proxies on ports different than Galaxy (so it can target external proxies without nginx/uwsgi).
 - Fix up config options a bit.
2020-03-24 10:29:58 -04:00
John Chilton 04b21a06ff Allow remote container port monitoring for ITs.
Tested with Pulsar but not sure there is anything Pulsar specific about the implementation - simply set container_monitor_result on the job destination to 'callback' (instead of implicit default of 'file'). This causes the monitor.py script to hit a new job_ports API (that mirrors job_files API) and uses the same security mechanism (per-job keys that are only active while the job is active).

PR contains fixes for embedded Pulsar configuration handling, embedded Pulsar under uwsgi, and the introduction of new feature that allows dynamic expansion of ``$UWSGI_PORT`` inside of galaxy_infrastructure_url.
2020-02-19 09:53:10 -05:00
mvdbeek d5fc7d426e Fix interactivetool python 3 support and tests
- enables docker destination for interactivetool tests
- fixes a wrong argument in entrypoint management
- fixes the test setup that targeted a previous iteration (which was
  still called realtimetools)
- prevents deleting the working directory before python has a chance to
  start the container monitor (that's the sleep command)
- fixes some odd interactive tool test assertions
- uses unicode arguments in key_type_token_mapping.py.
  uwsgi arguments are always passed as bytestrings.
2020-01-09 14:40:48 +01:00
John Chilton 45019c3fbd Move galaxy testing utilities into more sane package structure.
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does.

I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver.

Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
2019-11-12 09:03:06 -05:00
Bjoern Gruening 075a356a8c RT to IT 2019-08-31 13:34:51 +02:00