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: respect ST2_DATABASE__* vars #6278

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

This lightly refactors pants-plugins/uses_services to make it easier to mention the ST2_* conf vars (introduced in #6277) in the instructions messages that the plugin prints when a service isn't running.

Then this PR updates the mongo rules to make use of the ST2_DATABASE__* conf vars if present. Thus, people can use ST2_DATABASE__* both in production and when testing to use whatever database they choose.

This only passes a subset of the possible ST2_DATABASE__* vars to tests. If anyone wants to add others, they need to review the tests to see if the tests override that setting or not. This is the config that tells pants to pass these vars to pytest:

st2/pants.toml

Lines 238 to 249 in 5c384d9

[test]
extra_env_vars = [
# Use this so that the test system does not require the stanley user.
# For example: export ST2TESTS_SYSTEM_USER=${USER}
"ST2TESTS_SYSTEM_USER",
# Use these to override MongoDB connection details
# "ST2_DATABASE__HOST", # Tests override this with "127.0.0.1"
"ST2_DATABASE__PORT",
# "ST2_DATABASE__DB_NAME", # Tests override this with: "st2-test{ST2TESTS_PARALLEL_SLOT}"
"ST2_DATABASE__CONNECTION_TIMEOUT",
"ST2_DATABASE__USERNAME",
"ST2_DATABASE__PASSWORD",

For background context 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database enhancement infrastructure: ci/cd pantsbuild refactor 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.

1 participant