Skip to content

Commit c6d070b

Browse files
committed
Update build.gradle to actually check tenantaware property value
Signed-off-by: Daniel Widdis <[email protected]>
1 parent 0d8173c commit c6d070b

File tree

3 files changed

+14
-29
lines changed

3 files changed

+14
-29
lines changed

plugin/build.gradle

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,13 @@ integTest {
189189
systemProperty "password", System.getProperty("password")
190190

191191
// Only tenant aware test if set
192-
if (System.getProperty("tests.rest.tenantaware") != null) {
192+
if (System.getProperty("tests.rest.tenantaware") == "true") {
193193
filter {
194194
includeTestsMatching "org.opensearch.ml.rest.*TenantAwareIT"
195195
}
196196
systemProperty "plugins.ml_commons.multi_tenancy_enabled", "true"
197197
}
198198

199-
if (System.getProperty("tests.rest.tenantaware") != null) {
200-
environment "plugins.ml_commons.multi_tenancy_enabled", "true"
201-
}
202-
203199
// Only rest case can run with remote cluster
204200
if (System.getProperty("tests.rest.cluster") != null && System.getProperty("tests.rest.tenantaware") == null) {
205201
filter {
@@ -226,32 +222,28 @@ integTest {
226222

227223
// The 'doFirst' delays till execution time.
228224
doFirst {
229-
if (System.getProperty("tests.rest.tenantaware") != null) {
225+
if (System.getProperty("tests.rest.tenantaware") == "true") {
230226
def ymlFile = file("$buildDir/testclusters/integTest-0/config/opensearch.yml")
231227
if (ymlFile.exists()) {
232228
ymlFile.withWriterAppend {
233229
writer ->
234230
writer.write("\n# Set multitenancy\n")
235231
writer.write("plugins.ml_commons.multi_tenancy_enabled: true\n")
236232
}
237-
} else {
238-
throw new GradleException("opensearch.yml not found at: $ymlFile")
239-
}
240-
}
241-
242-
// TODO this properly uses the remote client factory but needs a remote cluster set up
243-
if (System.getProperty("tests.rest.cluster") != null && System.getProperty("tests.rest.tenantaware") != null) {
244-
def ymlFile = file("$buildDir/testclusters/integTest-0/config/opensearch.yml")
245-
if (ymlFile.exists()) {
246-
ymlFile.withWriterAppend { writer ->
247-
writer.write("\n# Use a remote cluster\n")
248-
writer.write("plugins.ml_commons.remote_metadata_type: RemoteOpenSearch\n")
249-
writer.write("plugins.ml_commons.remote_metadata_endpoint: https://127.0.0.1:9200\n")
233+
// TODO this properly uses the remote client factory but needs a remote cluster set up
234+
// TODO get the endpoint from a system property
235+
if (System.getProperty("tests.rest.cluster") != null) {
236+
ymlFile.withWriterAppend { writer ->
237+
writer.write("\n# Use a remote cluster\n")
238+
writer.write("plugins.ml_commons.remote_metadata_type: RemoteOpenSearch\n")
239+
writer.write("plugins.ml_commons.remote_metadata_endpoint: https://127.0.0.1:9200\n")
240+
}
250241
}
251242
} else {
252243
throw new GradleException("opensearch.yml not found at: $ymlFile")
253244
}
254245
}
246+
255247
// Tell the test JVM if the cluster JVM is running under a debugger so that tests can
256248
// use longer timeouts for requests.
257249
def isDebuggingCluster = getDebug() || System.getProperty("test.debug") != null

plugin/src/main/java/org/opensearch/ml/sdkclient/SdkClientFactory.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ public static SdkClient createSdkClient(Client client, NamedXContentRegistry xCo
8787
String serviceName = REMOTE_METADATA_SERVICE_NAME.get(settings);
8888
Boolean multiTenancy = ML_COMMONS_MULTI_TENANCY_ENABLED.get(settings);
8989

90-
/*
91-
// TODO Temp to force DDB for testing purposes
92-
remoteMetadataType = AWS_DYNAMO_DB;
93-
remoteMetadataEndpoint = "https://pkg8g8qwyrlggws3v4bk.us-west-2.aoss.amazonaws.com:443";
94-
region = Region.US_WEST_2.id();
95-
serviceName = "aoss";
96-
*/
97-
9890
switch (remoteMetadataType) {
9991
case REMOTE_OPENSEARCH:
10092
if (Strings.isBlank(remoteMetadataEndpoint)) {

plugin/src/test/java/org/opensearch/ml/rest/MLCommonsTenantAwareRestTestCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
public abstract class MLCommonsTenantAwareRestTestCase extends MLCommonsRestTestCase {
3737

3838
// Toggle to run DDB tests
39-
protected static final boolean DDB = true;
39+
// TODO: Get this from a property
40+
protected static final boolean DDB = false;
4041

4142
protected static final String DOC_ID = "_id";
4243

@@ -81,7 +82,7 @@ public abstract class MLCommonsTenantAwareRestTestCase extends MLCommonsRestTest
8182
protected final RestRequest nullTenantMatchAllRequest = getRestRequestWithHeadersAndContent(null, MATCH_ALL_QUERY);
8283

8384
protected static boolean isMultiTenancyEnabled() throws IOException {
84-
// pass -Dtests.rest.tenantaware on gradle command line to enable
85+
// pass -Dtests.rest.tenantaware=true on gradle command line to enable
8586
return Boolean.parseBoolean(System.getProperty(ML_COMMONS_MULTI_TENANCY_ENABLED.getKey()))
8687
|| Boolean.parseBoolean(System.getenv(ML_COMMONS_MULTI_TENANCY_ENABLED.getKey()));
8788
}

0 commit comments

Comments
 (0)