Skip to content

Commit ee35cde

Browse files
enable model access control in secure reset IT (#940) (#941)
Signed-off-by: Yaliang Wu <[email protected]> (cherry picked from commit 1d80d2c) Co-authored-by: Yaliang Wu <[email protected]>
1 parent 84db0a2 commit ee35cde

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
import java.util.Arrays;
1111
import java.util.Map;
1212

13+
import org.apache.http.HttpHeaders;
1314
import org.apache.http.HttpHost;
15+
import org.apache.http.message.BasicHeader;
1416
import org.junit.After;
1517
import org.junit.Before;
1618
import org.junit.Rule;
1719
import org.junit.rules.ExpectedException;
20+
import org.opensearch.client.Response;
1821
import org.opensearch.client.ResponseException;
1922
import org.opensearch.client.RestClient;
2023
import org.opensearch.commons.rest.SecureRestClientBuilder;
@@ -29,6 +32,7 @@
2932
import org.opensearch.search.builder.SearchSourceBuilder;
3033

3134
import com.google.common.base.Throwables;
35+
import com.google.common.collect.ImmutableList;
3236

3337
public class SecureMLRestIT extends MLCommonsRestTestCase {
3438
private String irisIndex = "iris_data_secure_ml_it";
@@ -56,6 +60,17 @@ public class SecureMLRestIT extends MLCommonsRestTestCase {
5660

5761
@Before
5862
public void setup() throws IOException {
63+
Response response = TestHelper
64+
.makeRequest(
65+
client(),
66+
"PUT",
67+
"_cluster/settings",
68+
null,
69+
"{\"persistent\":{\"plugins.ml_commons.model_access_control_enabled\":true}}",
70+
ImmutableList.of(new BasicHeader(HttpHeaders.USER_AGENT, ""))
71+
);
72+
assertEquals(200, response.getStatusLine().getStatusCode());
73+
5974
if (!isHttps()) {
6075
throw new IllegalArgumentException("Secure Tests are running but HTTPS is not set");
6176
}

0 commit comments

Comments
 (0)