Skip to content
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

CURATOR-633: Fix backward compatibility in tests #409

Conversation

martin-g
Copy link
Member

Run TestConnectionStateManager#testConnectionStateRecoversFromUnexpectedExpiredConnection only for Zookeeper 3.6.x

@@ -92,6 +94,7 @@ public void stateChanged(CuratorFramework client, ConnectionState newState)

@Test
public void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
assumeTrue(() -> (getMajor() == 3 && getMinor() >= 6) || (getMajor() > 4), "Zookeeper version must be 3.6 or higher");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not really work...
It seems javac inlines the values of the constants and the test still prints 3 and 6 even for curator-test-zk35 modole.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean that this tests didn't work with 3.5?

I can't remember about this problem

@Randgalt @tisonkun

@martin-g
Copy link
Member Author

martin-g commented Feb 25, 2022 via email

@eolivelli
Copy link
Contributor

Can you rebase in order to pick your changes?

…tConnectionStateRecoversFromUnexpectedExpiredConnection only for Zookeeper 3.6.x

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
@martin-g martin-g force-pushed the curator-633-execute-test-only-on-zookeeper-3.6.x branch from f2056aa to 84ac20d Compare February 25, 2022 20:40
@martin-g
Copy link
Member Author

CI is green! 🥳

@@ -91,7 +92,10 @@ public void stateChanged(CuratorFramework client, ConnectionState newState)
}

@Test
public void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not logically incompatible.

  1. If you remove @Test above, this test doesn't actually run in any condition.
  2. The original error report on JIRA looks because ZOOKEEPER-3269 - Add queueEvent to the Testable facade zookeeper#799 wasn't include in zk 3.5. And the usage of queueEvent here can be emulated by bringing back bridges of queueEvent like CURATOR-558 - part 1 of ZK 3.6 updates #344 removed - it's not a logically incompatible.

Copy link
Member

@tisonkun tisonkun Feb 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another perspective is that whether or not we want to test that it's zk35compatible. If we don't intend to do that, we can move the test to another (new) class and assign it to zk36 group.

Copy link
Member Author

@martin-g martin-g Feb 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If you remove @Test above, this test doesn't actually run in any condition.

I am not sure why do you explain this to me. I didn't touch @Test and the test is still executed in curator-framework Maven module, where Zookeeper is 3.6.3.
The problem is when this test is executed in curator-test-zk35 module (Zookeeper 3.5.7) where #queueEvent() is not available.
https://issues.apache.org/jira/browse/ZOOKEEPER-3269 is "Fixed" only for 3.6.0+

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @tisonkun you are suggesting to create a set of tests that run only against zk 3.6+
That is to generalise the approach of this fix.

Probably we can create a annotation a little junit extension.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW if we don't have much time we can keep this patch an unblock ci and the upcoming release

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to create a set of tests that run only against zk 3.6+

@eolivelli we have already implemented this. If you want to merge a workaround for unblocking release, it's OK to me, and I'll prepare a followup for explaining.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI #411.

@martin-g you can integrate in this PR and close #411.

@@ -91,7 +92,10 @@ public void stateChanged(CuratorFramework client, ConnectionState newState)
}

@Test
public void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW if we don't have much time we can keep this patch an unblock ci and the upcoming release

void testConnectionStateRecoversFromUnexpectedExpiredConnection() throws Exception {
final int major = getVersionPart("MAJOR");
final int minor = getVersionPart("MINOR");
assumeTrue(major == 3 && minor >= 6 || major > 4, "Zookeeper version must be 3.6 or higher");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the boolean condition should not be ==3 || > 4, what if ==4?

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have committed @tisonkun 's patch.
I didn't know we already have those tags.

Thank you very much @martin-g for your efforts

@eolivelli eolivelli closed this Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants