Refactor to remove test args from remote test command#3266
Refactor to remove test args from remote test command#3266tm-jdelapuente merged 1 commit intomasterfrom
Conversation
cda7c36 to
56f7082
Compare
|
I think we pass this as an environment variable now, yes? |
|
What do you mean? I don't think I'm following, because the above seems unrelated to that since it's about |
|
The information about which sub-tests to run must be given to it somehow. IIRC it was originally an argument but then we changed it to an env var to avoid issues like this. I'm checking whether that does in fact happen as expected. |
|
Just double checking, I understand you don't expect any further action from me while you check it? |
|
Yup ok we set one called TESTS which is read by the various test runners. |
Context
plz test [TARGET]can take an argument to specify specific parts of a test target to run.For example,
plz test //[TARGET] -- [TestSubTarget]runs the subtarget function rather than all of the test functions in the target.You can also specify what tests to run at a more granular level: e.g. [TestSubTarget/[NestedTestFunction]/[NestedTestFunction]
Problem
When specifying subtargets in
plz test ...you get an error when you pass an argument that has a slash (e.g.plz test //[TARGET] -- TestSubTarget/MyTestFunction.This shows up by running an additional test that errors, such as
Root cause
Please is constructing a
cmdthat callsteeand appendsTestArgsat the end.This constructs a command like
$TEST 2>&1 | tee $TMP_DIR/test.results [one or more subtests].This is relevant because
teereads fromstdin($TEST 2>&1) and writes tostdoutand files ($TMP_DIR/test.results [one or more subtests]).Thus, this means that
plz test //[TARGET] -- [TestSubTarget]creates and writes to the fileTestSubTargetplz test //[TARGET] -- [TestSubTarget/[NestedTestFunction]/[NestedTestFunction]interprets the forward slashes as file paths and tries to create a file in said path but errors because the directory doesn't existSolution
The implication is that we need to avoid passing the subtests before the pipe to
tee.I thus removed the
ifstatement to avoid passing the test arguments in the command.Testing
I built Please with these changes and it worked as expected, only printing the subtests I passed and no erroring like it does now.
I'm concerned about any regressions and am not sure how to best test this.
Pending work
This only solves the problem on remote execution, not local execution.