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

pants-plugins/uses_services: add support for uses=st2cluster in BUILD metadata #6279

Merged
merged 6 commits into from
Nov 19, 2024

Conversation

cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Nov 17, 2024

This PR's commits were extracted from #6273 where I'm working on getting pants+pytest to run integration tests.

Today, we run a dev st2 cluster using tools/launchdev.sh for all integration tests. However, only a subset of the tests actually make use of the running service. The only tests that require the dev st2 cluster are orquesta runner integration tests (which run today as part of integration tests) and the orquesta integration tests (in st2tests/integration/orquesta) that today run in a separate Orquesta Tests CI job.

The rest of the integration tests actually start the st2api or other process as part of the test, so they ignore the dev cluster, meaning CI doesn't need to the overhead of running the full cluster to run those tests. Plus, when running the tests locally, you don't need to run the dev cluster either, unless you need to run the orquesta tests.

So, this PR adds a new st2cluster service to pants-plugins/uses_services so that we can check for the running dev cluster and raise an error if the cluster isn't running when attempting to run the tests that need it.

I also added an st2cluster tag to the BUILD metadata of these tests so that it is simple to run only the tests that need st2cluster or run all integration tagged tests except for the st2cluster tagged tasks. To skip the st2cluster tagged tasks, you might run pants like this: pants --tag=integration --tag=-st2cluster test ::.

It might be helpful to review each commit of this PR. Sorry for the size of the first commit; I don't see a sane way to split this PR up any farther.

For background on pants-plugins/uses_services see:

@cognifloyd cognifloyd added this to the pants milestone Nov 17, 2024
@cognifloyd cognifloyd self-assigned this Nov 17, 2024
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Nov 17, 2024
@cognifloyd cognifloyd enabled auto-merge November 17, 2024 05:48
Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cognifloyd I've approved but left some comments. Most are about the copyright, which may well be correct, if those changes were started in 2023. But if not then please amend to 2024.

@cognifloyd
Copy link
Member Author

Most are about the copyright, which may well be correct, if those changes were started in 2023. But if not then please amend to 2024.

Doh! I messed up the copyright again. Thanks for catching that, I'll fix it today.

@cognifloyd cognifloyd disabled auto-merge November 18, 2024 14:16
The copyrights were copy/pasta. These files were written in 2024, not 2023.
@amanda11
Copy link
Contributor

@cognifloyd lint checks failed

…hosts/ports

In the uses_services plugin, I am now adding env var support
(in several PRs), but so far I've avoiding parsing conf files.

Plus, allowing reconfiguration of the st2cluster hosts/ports
would require the st2client and st2 dev cluster config to align.

Today, the st2cluster integration tests hardcode st2client's
base_url to `http://127.0.0.1`. Technically someone could override
the endpoint URLs with ST2_{AUTH,API,STREAM}_URL env vars, but
they would also need to make sure whatever cluster they use
has the examples pack and other things handled by `launchdev.sh`.

Today, the other alternative for using a different cluster would
be to forward the service ports to the localhost at the standard
ports.

For now, just use a separate host for each endpoint so it is
easier to support overriding via env vars and/or conf files
at some point in the future--if someone needs that. Until then,
we'll go with the minimal implementation that assumes the
default hosts and ports.
@cognifloyd cognifloyd force-pushed the pants-plugins-uses_services-st2cluster branch from 491a4a2 to b0767b9 Compare November 18, 2024 18:19
@cognifloyd cognifloyd enabled auto-merge November 18, 2024 18:26
@cognifloyd
Copy link
Member Author

K. I fixed my lint issue. All CI is passing 😄. One more review, and this can be merged.

@cognifloyd cognifloyd requested a review from a team November 18, 2024 18:45
@cognifloyd cognifloyd merged commit fefe7e5 into master Nov 19, 2024
42 checks passed
@cognifloyd cognifloyd deleted the pants-plugins-uses_services-st2cluster branch November 19, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement infrastructure: ci/cd pantsbuild size/L PR that changes 100-499 lines. Requires some effort to review. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants