Enhance Go testing support and add integration tests#332
Enhance Go testing support and add integration tests#332scyyx5 wants to merge 3 commits intoplease-build:masterfrom
Conversation
scyyx5
commented
Nov 11, 2025
- Update go_test to ensure proper handling of testing definitions.
- Modify please_repo_e2e_test to capture command output for assertions.
- Add integration test for testing_flag_test with expected output validation.
- Introduce necessary BUILD_FILE configurations for plugins and dependencies.
- Update go_test to ensure proper handling of testing definitions. - Modify please_repo_e2e_test to capture command output for assertions. - Add integration test for testing_flag_test with expected output validation. - Introduce necessary BUILD_FILE configurations for plugins and dependencies.
test/build_defs/e2e.build_defs
Outdated
| _please_repo_e2e_test = please_repo_e2e_test | ||
|
|
||
| def please_repo_e2e_test(name, expected_output=None, plz_command, repo, labels=[]): | ||
| def please_repo_e2e_test(name, expected_output=None, plz_command, repo, labels=[], expect_output_contains=None): |
There was a problem hiding this comment.
The upstream already has a expect_output_contains parameter which we shouldn't shadow. You're also introducing a second meaning of the term "output", which is going to be confusing. At a minimum I think the new parameter should be expected_plz_command_output, but I think it'd be nicer to support asserting on stdout and stderr independently, rather than capturing both in one file (at which point expect_stdout_contains and expect_stderr_contains are nice unambiguous names)
command > >(tee stdout.log) 2> >(tee stderr.log >&2) might work here, but you'll need to test that it preserves the exit code correctly. tee is a nice utility for duplicating stdin to a file. See https://stackoverflow.com/a/692407 for more explanation.
Either way, I think you should implement this as part of the upstream rule in https://github.com/please-build/plugin-integration-testing/blob/master/build_defs/e2e.build_defs so that other plugins can benefit from this change.
aside: can you spot the bug in https://github.com/please-build/plugin-integration-testing/blob/master/build_defs/e2e.build_defs#L89
…improved output handling