Skip to content

Commit b0d0997

Browse files
committed
Added tests for cross cluster operations
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
1 parent f4536df commit b0d0997

File tree

4 files changed

+574
-19
lines changed

4 files changed

+574
-19
lines changed

src/integrationTest/java/org/opensearch/security/privileges/int_tests/ClusterConfig.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public enum ClusterConfig {
4545

4646
private LocalCluster cluster;
4747

48+
/**
49+
* Optional: If we need to have a second remote cluster in our tests
50+
*/
51+
private LocalCluster remoteCluster;
52+
4853
ClusterConfig(
4954
String name,
5055
Function<LocalCluster.Builder, LocalCluster.Builder> clusterConfiguration,
@@ -67,6 +72,14 @@ LocalCluster cluster(Supplier<LocalCluster.Builder> clusterBuilder) {
6772
return cluster;
6873
}
6974

75+
LocalCluster remoteCluster(Supplier<LocalCluster.Builder> clusterBuilder) {
76+
if (remoteCluster == null) {
77+
remoteCluster = this.clusterConfiguration.apply(clusterBuilder.get()).build();
78+
remoteCluster.before();
79+
}
80+
return remoteCluster;
81+
}
82+
7083
void shutdown() {
7184
if (cluster != null) {
7285
try {
@@ -76,6 +89,14 @@ void shutdown() {
7689
}
7790
cluster = null;
7891
}
92+
if (remoteCluster != null) {
93+
try {
94+
remoteCluster.close();
95+
} catch (Exception e) {
96+
e.printStackTrace();
97+
}
98+
remoteCluster = null;
99+
}
79100
}
80101

81102
@Override

0 commit comments

Comments
 (0)