1919import java .util .concurrent .Executors ;
2020import java .util .concurrent .Future ;
2121
22+ import org .junit .BeforeClass ;
2223import org .junit .Test ;
24+ import org .slf4j .Logger ;
25+ import org .slf4j .LoggerFactory ;
2326
2427import redis .clients .authentication .core .IdentityProvider ;
2528import redis .clients .authentication .core .IdentityProviderConfig ;
2932import redis .clients .jedis .Connection ;
3033import redis .clients .jedis .ConnectionPoolConfig ;
3134import redis .clients .jedis .DefaultJedisClientConfig ;
35+ import redis .clients .jedis .EndpointConfig ;
3236import redis .clients .jedis .HostAndPort ;
3337import redis .clients .jedis .HostAndPorts ;
3438import redis .clients .jedis .JedisClientConfig ;
3539import redis .clients .jedis .JedisCluster ;
36- import redis .clients .jedis .JedisClusterTestBase ;
3740
38- public class TokenBasedAuthenticationClusterIntegrationTests extends JedisClusterTestBase {
41+ public class TokenBasedAuthenticationClusterIntegrationTests {
42+ private static final Logger log = LoggerFactory
43+ .getLogger (TokenBasedAuthenticationClusterIntegrationTests .class );
44+
45+ private static EndpointConfig endpointConfig ;
46+ private static HostAndPort hnp ;
47+
48+ @ BeforeClass
49+ public static void before () {
50+ try {
51+ endpointConfig = HostAndPorts .getRedisEndpoint ("cluster-entraid-acl" );
52+ hnp = endpointConfig .getHostAndPort ();
53+ } catch (IllegalArgumentException e ) {
54+ log .warn ("Skipping test because no Redis endpoint is configured" );
55+ org .junit .Assume .assumeTrue (false );
56+ }
57+ }
3958
4059 @ Test
4160 public void testClusterInitWithAuthXManager () {
@@ -55,12 +74,11 @@ public Token requestToken() {
5574 AuthXManager manager = new AuthXManager (EntraIDTokenAuthConfigBuilder .builder ()
5675 .lowerRefreshBoundMillis (1000 ).identityProviderConfig (idpConfig ).build ());
5776
58- HostAndPort hp = HostAndPorts .getClusterServers ().get (0 );
5977 int defaultDirections = 5 ;
6078 JedisClientConfig config = DefaultJedisClientConfig .builder ().authXManager (manager ).build ();
6179
6280 ConnectionPoolConfig DEFAULT_POOL_CONFIG = new ConnectionPoolConfig ();
63- try (JedisCluster jc = new JedisCluster (hp , config , defaultDirections ,
81+ try (JedisCluster jc = new JedisCluster (hnp , config , defaultDirections ,
6482 DEFAULT_POOL_CONFIG )) {
6583
6684 assertEquals ("OK" , jc .set ("foo" , "bar" ));
@@ -98,13 +116,12 @@ public Token requestToken() {
98116 return result ;
99117 }).when (authXManager ).addConnection (any (Connection .class ));
100118
101- HostAndPort hp = HostAndPorts .getClusterServers ().get (0 );
102119 JedisClientConfig config = DefaultJedisClientConfig .builder ().authXManager (authXManager )
103120 .build ();
104121
105122 ExecutorService executorService = Executors .newFixedThreadPool (2 );
106123 CountDownLatch latch = new CountDownLatch (1 );
107- try (JedisCluster jc = new JedisCluster (Collections .singleton (hp ), config )) {
124+ try (JedisCluster jc = new JedisCluster (Collections .singleton (hnp ), config )) {
108125 Runnable task = () -> {
109126 while (latch .getCount () > 0 ) {
110127 assertEquals ("OK" , jc .set ("foo" , "bar" ));
0 commit comments