Skip to content

Commit

Permalink
GEODE-9704: Ensure that register interest is called before ready for …
Browse files Browse the repository at this point in the history
…events (apache#7442)


- RegisterInterestOps need to happen before ReadyForEventsOp is sent
  These changes make sure that happens.

- Added an InterestResultPolicyCheck 

Authored-by: Barry Oglesby <[email protected]>

Un-ignored a test that will reproduce the issue
periodically during a number of runs. It is a flaky
test without the core fix.

Authored-by: Jinmei Liao <[email protected]>
  • Loading branch information
mhansonp authored Apr 6, 2022
1 parent 141d43d commit 30bd1ce
Show file tree
Hide file tree
Showing 12 changed files with 1,084 additions and 897 deletions.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.stream.IntStream;

import org.junit.After;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
Expand All @@ -50,7 +49,7 @@
import org.apache.geode.test.junit.rules.ServerStarterRule;

@Category({SecurityTest.class})
public class AuthExpirationDUnitTest {
public class AuthExpirationDistributedTest {
@Rule
public ClusterStartupRule cluster = new ClusterStartupRule();

Expand Down Expand Up @@ -119,7 +118,8 @@ public void cqClientWillReAuthenticateAutomatically() throws Exception {
}

@Test
public void registeredInterest_slowReAuth_policyDefault() throws Exception {
public void registeredInterestForKeysAndValidatedTheyWereAllReceived_slowReAuth_policyDefault()
throws Exception {
int serverPort = server.getPort();
clientVM = cluster.startClientVM(0,
c -> c.withProperty(SECURITY_CLIENT_AUTH_INIT, UpdatableUserAuthInitialize.class.getName())
Expand Down Expand Up @@ -171,23 +171,22 @@ public void registeredInterest_slowReAuth_policyDefault() throws Exception {
}

@Test
@Ignore("unnecessary test case for re-auth, but it manifests GEODE-9704")
public void registeredInterest_slowReAuth_policyKeys_durableClient() throws Exception {
public void registeredInterestForKeysAndValidatedTheyWereAllReceived_slowReAuth_policyNone_durableClient()
throws Exception {
int serverPort = server.getPort();
clientVM = cluster.startClientVM(0,
c -> c.withProperty(SECURITY_CLIENT_AUTH_INIT, UpdatableUserAuthInitialize.class.getName())
.withProperty(DURABLE_CLIENT_ID, "123456")
.withPoolSubscription(true)
.withServerConnection(serverPort));


clientVM.invoke(() -> {
UpdatableUserAuthInitialize.setUser("user1");
ClientCache clientCache = ClusterStartupRule.getClientCache();
Region<Object, Object> region = clientCache
.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create("region");

region.registerInterestForAllKeys(InterestResultPolicy.KEYS, true);
region.registerInterestForAllKeys(InterestResultPolicy.NONE, true);
clientCache.readyForEvents();
UpdatableUserAuthInitialize.setUser("user11");
// wait for time longer than server's max time to wait to re-authenticate
Expand Down Expand Up @@ -215,7 +214,8 @@ public void registeredInterest_slowReAuth_policyKeys_durableClient() throws Exce
private static KeysCacheListener myListener = new KeysCacheListener();

@Test
public void registeredInterest_slowReAuth_policyNone_durableClient() throws Exception {
public void registeredInterestForKeysAndValidatedTheyWereAllReceived_slowReAuth_policyNone_CacheListener_durableClient()
throws Exception {
int serverPort = server.getPort();
clientVM = cluster.startClientVM(0,
c -> c.withProperty(SECURITY_CLIENT_AUTH_INIT, UpdatableUserAuthInitialize.class.getName())
Expand Down Expand Up @@ -260,7 +260,7 @@ public void registeredInterest_slowReAuth_policyNone_durableClient() throws Exce


@Test
public void registeredInterest_slowReAuth_policyNone_nonDurableClient()
public void registeredInterestForKeysAndValidatedTheyWereAllReceived_slowReAuth_policyNone_nonDurableClient()
throws Exception {
int serverPort = server.getPort();
clientVM = cluster.startClientVM(0,
Expand Down
Loading

0 comments on commit 30bd1ce

Please sign in to comment.