-
Notifications
You must be signed in to change notification settings - Fork 1
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
Strict mode for testexec structure #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- keeping
Path
tracked: 👍 - lots of additional logging: 👍
- tests tests tests: 👍 🙇
- introducing publicly exported callbacks to the recursion process: 👎 adds complexity and maintenance surface, and yet I have a hard time seeing how it'll adds value.
testexec/testexec.go
Outdated
} | ||
|
||
func (tcfg Tester) doSequence(t *testing.T, hunk *testmark.Hunk, stdin io.Reader, stdout, stderr io.Writer) (exitcode int) { | ||
t.Helper() | ||
t.Logf("running sequence: %q", hunk.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strikes me as usually redundant due to the presence of the test names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh kind of. Assuming you know where you started from and don't care to know whether it's running a sequence or a script without looking at the md.
(is this now a soft prerequisite for what we want #11 to become? Because of the |
No. I've been using it to debug which blobs are running and which aren't. I would also use it to make some changes to how Needing to keep
|
I'm trying to actually use it for the |
Yeah I don't entirely love the " |
It would be nice to be able to have it anywhere but it gets a bit wonky where I need to skip the However, using the existing code for
List of executable hunks in the markdown file.
List of hunks that were executed
|
If I take out the existing func recursionFn(t *testing.T, dir testmark.DirEnt) error {
if dir.Name == "net" && *testutil.FlagOffline {
return fmt.Errorf("skipping test %q due to offline flag: %w", dir.Path, testexec.SkipRecursion)
}
return testexec.RecursionFn_Then(t, dir)
} Then I get a different set of results that will need a bit of tweaking in the markdown to get the desired effect. It should behave more consistently for mixed net and non-net groups. But there needs to be a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a lot happier with this now, with this more specific focus 🙇
809162f
to
0080f43
Compare
- Adds tests to output that will show up as skipped. This should make the behavior of testexec easier understand and debug using go test -v. - Adds a RecursionFn to testexec to give users the ability to control recursion. - Adds a Path variable to DirEnt structs which contains its full path. Overall default behavior is unchanged.
8832a5d
to
a9ca5f6
Compare
- Removes the recursion override. - Adds strict default mode - Adds tests for failing conditions that need to be run manually because there's really just not a good way to do that. - Splits test exercise markdown files into self, strict, and invalid based on whether they should pass or fail always or in strict mode.
a9ca5f6
to
59d311a
Compare
testexec/testexec.go
Outdated
if tcfg.DisableStrictMode { | ||
t.SkipNow() | ||
} | ||
t.FailNow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, pretty minor thing, but on re-review I notice these four lines recur a number of times pretty much verbatim. I think extracting a tiny skipOrFailStrictly(t)
function might be worth it.
The reason to log for it could even be moved in as a fmt string arg and varargs, although I'm neutral on whether or not it's done that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the logs seems good.
d438295
to
7855604
Compare
Adds a strict mode such that the testexec structure is enforced by default.
Original:
Overall default behavior is unchanged.