-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
logictest: add TestLogic_tmp for testing untracked logic test files #85386
Conversation
03789cb
to
1419d2e
Compare
pkg/cmd/dev/testlogic.go
Outdated
@@ -120,13 +118,6 @@ func (d *dev) testlogic(cmd *cobra.Command, commandLine []string) error { | |||
return err | |||
} | |||
|
|||
if !noGen { |
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.
Not 100% sure about deleting this flag. I think this functionality is still useful.
One option if you find the --no-gen
thing annoying is to add support for an environment variable (like DEV_NO_GENERATE_LOGICTEST
) so you can set it in your profile. We already support environment variables like DEV_NO_REMOTE_CACHE
for turning off functionality globally.
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.
Do you think it's still useful for dev test
too, or just dev logictest
?
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 can go either way on dev test
, definitely I think keep it for testlogic
though.
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.
SGTM. I added it back to just testlogic
for now.
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.
Reviewed all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @mgartner)
-- commits
line 6 at r1:
Thanks for doing this! Should we add some linter to prevent from checking in any of the logic test files that start with the underscore?
1419d2e
to
7d821dc
Compare
Previously, yuzefovich (Yahor Yuzefovich) wrote…
We can do that, but I wouldn't say its strictly necessary. If a file with an underscore prefix was added - it would be tested in CI, not ignored. So we wouldn't unknowingly add bad tests. The only risk would be adding so many underscore-prefixed test files that we start to see timeouts again. I created an issue to track this: #85457 |
2720f0b
to
4c39406
Compare
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.
Reviewed 1 of 44 files at r1, 44 of 44 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner, @mgartner, and @rickystewart)
-- commits
line 28 at r2:
nit: I think this part of the commit message needs an update.
pkg/cmd/dev/test.go
line 227 at r2 (raw file):
// We need to re-generate logictest files if we're testing a // logictest target. if !noGen {
This removal might require a bump to the version of cockroachdb/dev
.
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.
Awesome, thanks for this work.
This removal might require a bump to the version of cockroachdb/dev.
+1
This commit improves the developer experience when working with logic tests. The logic test generator no longer generates a dedicated test for logic tests files prefixed with "_". The hard-coded `TestLogic_tmp` test has been added which runs all such logic test files. This allows developers to create and run temporary test files that are not checked into the repository, without repeatedly regenerating and reverting changes to the `generated_test.go` files. For example, if you add a git-ignored file logic test file, `pkg/sql/logictest/testdata/logic_test/__test`, you can run it with the `local` config with the command: ./dev test pkg/sql/logictest/tests/local -f TestLogic_tmp Previously, to facilitate running these types of tests, `./dev test` would automatically regenerate logic tests every time tests were run. This was primarily motivated by the desire to make testing temporary logic test files easier - a developer would not have to run `./dev gen logictest` every time they wanted to test a temporary file. However, this was a poor experience because it made running tests significantly slower, and logic tests generated for temporary logic test files would have to be reverted repeatedly. `TestLogic_tmp` eliminates the need for this automatic regeneration, so it has been removed. Note that `./dev testlogic` still automatically regenerates log tests. The `--no-gen` flag, which disabled automatic regeneration, is no longer supported for `./dev test`. It is still supported for `./dev testlogic`. When committing a new logic test file to the repository, developers must now run `./dev gen testlogic` or `./dev testlogic ...` to generate logic tests for the new file. Release note: None
4c39406
to
1765f61
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajwerner and @yuzefovich)
Previously, yuzefovich (Yahor Yuzefovich) wrote…
Thanks for doing this! Should we add some linter to prevent from checking in any of the logic test files that start with the underscore?
We can do that, but I wouldn't say its strictly necessary. If a file with an underscore prefix was added - it would be tested in CI, not ignored. So we wouldn't unknowingly add bad tests. The only risk would be adding so many underscore-prefixed test files that we start to see timeouts again.
I created an issue to track this: #85457
Previously, yuzefovich (Yahor Yuzefovich) wrote…
nit: I think this part of the commit message needs an update.
Done.
pkg/cmd/dev/test.go
line 227 at r2 (raw file):
Previously, yuzefovich (Yahor Yuzefovich) wrote…
This removal might require a bump to the version of
cockroachdb/dev
.
Done.
TFTRs! bors r+ |
Build succeeded: |
This commit improves the developer experience when working with logic
tests. The logic test generator no longer generates a dedicated test for
logic tests files prefixed with "_". The hard-coded
TestLogic_tmp
testhas been added which runs all such logic test files. This allows
developers to create and run temporary test files that are not checked
into the repository, without repeatedly regenerating and reverting
changes to the
generated_test.go
files.For example, if you add a git-ignored file logic test file,
pkg/sql/logictest/testdata/logic_test/__test
, you can run it with thelocal
config with the command:Previously, to facilitate running these types of tests,
./dev test
would automatically regenerate logic tests every time tests were run.
This was primarily motivated by the desire to make testing temporary
logic test files easier - a developer would not have to run
./dev gen logictest
every time they wanted to test a temporary file.However, this was a poor experience because it made running tests
significantly slower, and logic tests generated for temporary logic test
files would have to be reverted repeatedly.
TestLogic_tmp
eliminatesthe need for this automatic regeneration, so it has been removed. The
--no-gen
flag, which disabled automatic regeneration, has also beenremoved. When committing a new logic test file to the repository,
developers must now run
./dev gen testlogic
to generate logic testsfor it.
Release note: None