Fix getNextValue() to increase the number of milliseconds if needed#18588
Fix getNextValue() to increase the number of milliseconds if needed#18588findepi merged 2 commits intotrinodb:masterfrom
getNextValue() to increase the number of milliseconds if needed#18588Conversation
|
Is there a test that reproduces the issue? |
I stumbled over it on I can add however a test in |
2b3dd7c to
138c307
Compare
There was a problem hiding this comment.
Can we ensure automatically that this doesn't happen?
The method is silently ignored if not annotated with @Test
There was a problem hiding this comment.
We shouldn’t be overriding tests like that. If necessary, add new tests specific for the type.
There was a problem hiding this comment.
I don't follow.
This is pre-existing functionality.
Please add more detail to the comment.
Simply create a new method instead of doing overrides?
There was a problem hiding this comment.
I'm just responding to your comment about "ensuring automatically it doesn't happen". Structuring tests that way is not a good practice. It makes it hard to reason about which tests apply where (in some cases, the tests in AbstractXXX apply, in others they are completely overwritten, etc. -- usual arguments about using inheritance for reusing behavior in other contexts). We should fix them separately and not do that going forward.
There was a problem hiding this comment.
That is how ATDQ, BCT and other similar "super" test classes are designed to work. We'll need to rethink how to structure those before those can be migrated over safely - since without that it's hard to have re-usable tests which also evolve over time (e.g. testRange is overridden today to throw SkipException but in future once the feature is there the override can be removed).
There was a problem hiding this comment.
cc: @ksobolew any ideas to how to get this to work or how to restructure tests to avoid subclassing when using JUnit5?
There was a problem hiding this comment.
Well, I can see that the implementations in the base class assert that the relevant properties of the type are Optional.empty(). They could, instead, do some assertions if it's not empty, and use some protected methods to get the expected result. But I'm not sure if that would work with all the types. It's kind of similar to how hasBehavior is used in connector tests...
There was a problem hiding this comment.
That is how ATDQ, BCT and other similar "super" test classes are designed to work. We'll need to rethink how to structure those before those can be migrated over safely
I can think of many different, more "pure" approaches.
The whole idea of BCT is impure and we could remove it. Connectors should have tests for features they implement.
Of course, this is straw-man's proposal. While letting us free of test overrides, this would lead to much worse test coverage.
138c307 to
4d6ae7d
Compare
There was a problem hiding this comment.
For me, these all run properly as is if you change the parent class AbstractTestType to use the org.testng.annotations.Test annotation instead of the junit org.junit.jupiter.api.Test annotation.
There was a problem hiding this comment.
Indeed, but that’s not how junit works — and we’re in the process of replacing testng with junit
There was a problem hiding this comment.
We should invest into writing a checker for this for the transition period like we have multiple for TestNG already. It seems very easy to do a migration but not realize multiple tests aren't running anymore.
There was a problem hiding this comment.
Yeah, this is a huge landmine. I already stepped on it some time ago and we briefly discussed countermeasures, but nothing came out of it. I suppose we could write an Error Prone check for this (I am surprised that there is no one already).
e237c0a to
755d5e6
Compare
|
Rebased on |
core/trino-spi/src/main/java/io/trino/spi/type/LongTimestampWithTimeZoneType.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/test/java/io/trino/type/TestLongTimestampWithTimeZoneType.java
Outdated
Show resolved
Hide resolved
9224a3a to
7a2bfab
Compare
7a2bfab to
d9f6b90
Compare
Description
This is a potential correctness issue when using as input
getNextValue()will returneven though it should have been returning
Additional context and related issues
Cherry-picked from #14648
PR contains as well a cherry-pick from #18594 for JUnit5 related changes.
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: