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

Add support for extra env variables in go tests #16013

Merged
merged 2 commits into from Jul 5, 2022

Conversation

wfscheper
Copy link
Contributor

@wfscheper wfscheper commented Jun 30, 2022

This addresses #15963 by plumbing through [test].extra_env_vars and adding the test_extra_env_vars field to go_package.

[ci skip-rust]

[ci skip-build-wheels]

[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@wfscheper
Copy link
Contributor Author

This seemed pretty straightforward (thanks for the very helpful hints @Eric-Arellano!), but since it's my first PR I went through the WIP/Draft workflow. Broke the change up so that hopefully it's easier to review the two additions.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Woohoo! Thanks so much! I'll cherry-pick this to 2.13 because it seems low risk and we haven't yet switched from a1 to rc0

@Eric-Arellano Eric-Arellano marked this pull request as ready for review June 30, 2022 15:39
@Eric-Arellano Eric-Arellano requested a review from tdyas June 30, 2022 15:39
@Eric-Arellano Eric-Arellano added this to the 2.13.x milestone Jun 30, 2022
@Eric-Arellano Eric-Arellano changed the title WIP: Add support for extra env variables in go tests Add support for extra env variables in go tests Jun 30, 2022
@wfscheper
Copy link
Contributor Author

Hmm. Looks like I broke the protobuf tests. I'll see if I can fix that.

@@ -179,6 +180,18 @@ class SkipGoTestsField(BoolField):
help = "If true, don't run this package's tests."


class GoTestExtraEnvVarsField(StringSequenceField):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should PythonTestsExtraEnvVarsField and this class share a common base class? The help message would be in the base class. This subclass can override the alias to add that test_ prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that if that's preferred. Is there an example of something similar?

Copy link
Contributor

Choose a reason for hiding this comment

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

PrefixedJvmResolveField and JvmResolveField

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine

@tdyas
Copy link
Contributor

tdyas commented Jun 30, 2022

Hmm. Looks like I broke the protobuf tests. I'll see if I can fix that.

Looks like rule graph errors. If the rules modified by this PR now depend on rules in another file, the rules in that other file will need to be referenced in the tests' RuleRunner setup.

[ci skip-rust]

[ci skip-build-wheels]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks! Sorry for the delay, I was out sick with Covid

@@ -179,6 +180,18 @@ class SkipGoTestsField(BoolField):
help = "If true, don't run this package's tests."


class GoTestExtraEnvVarsField(StringSequenceField):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine

@Eric-Arellano Eric-Arellano merged commit 6f52e0d into pantsbuild:main Jul 5, 2022
Eric-Arellano pushed a commit to Eric-Arellano/pants that referenced this pull request Jul 5, 2022
This addresses pantsbuild#15963 by plumbing through `[test].extra_env_vars` and adding the `test_extra_env_vars` field to `go_package`.

[ci skip-rust]

[ci skip-build-wheels]
Eric-Arellano added a commit that referenced this pull request Jul 5, 2022
… (#16067)

Add support for extra env variables in go tests (#16013)

This addresses #15963 by plumbing through `[test].extra_env_vars` and adding the `test_extra_env_vars` field to `go_package`.

[ci skip-rust]

[ci skip-build-wheels]

Co-authored-by: Walter Scheper <ratlaw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants