Skip to content

Commit

Permalink
Avoid using port 7443 in Lettuce tests #2326
Browse files Browse the repository at this point in the history
MDM ftw 🙄
  • Loading branch information
mp911de committed Feb 14, 2023
1 parent f48c227 commit 16589e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ work/cluster-node-7479.conf:
@echo cluster-enabled yes >> $@
@echo cluster-node-timeout 150 >> $@
@echo cluster-config-file $(shell pwd)/work/cluster-node-config-7479.conf >> $@
@echo cluster-announce-port 7443 >> $@
@echo cluster-announce-port 7442 >> $@
@echo requirepass foobared >> $@


Expand Down Expand Up @@ -289,7 +289,7 @@ work/stunnel.conf:
@echo key=$(ROOT_DIR)/work/ca/private/foo-host.decrypted.key.pem >> $@

@echo [ssl-cluster-node-1] >> $@
@echo accept = 127.0.0.1:7443 >> $@
@echo accept = 127.0.0.1:7442 >> $@
@echo connect = 127.0.0.1:7479 >> $@

@echo [ssl-cluster-node-2] >> $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
class RedisClusterPasswordSecuredSslIntegrationTests extends TestSupport {

private static final int CLUSTER_PORT_SSL_1 = 7443;
private static final int CLUSTER_PORT_SSL_1 = 7442;

private static final int CLUSTER_PORT_SSL_2 = 7444; // replica cannot replicate properly with upstream
private static final int CLUSTER_PORT_SSL_3 = 7445;
Expand All @@ -58,7 +58,7 @@ class RedisClusterPasswordSecuredSslIntegrationTests extends TestSupport {

@BeforeEach
void before() {
assumeTrue(CanConnect.to(host(), CLUSTER_PORT_SSL_1), "Assume that stunnel runs on port 7443");
assumeTrue(CanConnect.to(host(), CLUSTER_PORT_SSL_1), "Assume that stunnel runs on port 7442");
assumeTrue(CanConnect.to(host(), CLUSTER_PORT_SSL_2), "Assume that stunnel runs on port 7444");
assumeTrue(CanConnect.to(host(), CLUSTER_PORT_SSL_3), "Assume that stunnel runs on port 7445");
assumeTrue(CanConnect.to(host(), 7479), "Assume that Redis runs on port 7479");
Expand Down Expand Up @@ -117,7 +117,7 @@ void nodeConnectionsShouldWork() {
try {
node2Connection.sync().get(SLOT_1_KEY);
} catch (RedisCommandExecutionException e) {
assertThat(e).hasMessage("MOVED 1 127.0.0.1:7443");
assertThat(e).hasMessage("MOVED 1 127.0.0.1:7442");
}

connection.close();
Expand Down
7 changes: 6 additions & 1 deletion src/test/java/io/lettuce/test/settings/TestSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public static int port(int offset) {
* @return {@link #sslPort()} with added {@literal offset}
*/
public static int sslPort(int offset) {
return sslPort() + offset;
int port = sslPort() + offset;
if (port == 7443) {
throw new IllegalStateException("Please use a different port than 7443. Thank you.");
}
return port;
}

}

0 comments on commit 16589e5

Please sign in to comment.