Skip to content

Commit

Permalink
enable model access control in secure reset IT (#940) (#1249)
Browse files Browse the repository at this point in the history
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
Co-authored-by: Yaliang Wu <ylwu@amazon.com>
  • Loading branch information
zane-neo and ylwu-amzn authored Aug 25, 2023
1 parent aa85254 commit 37b36fb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugin/src/test/java/org/opensearch/ml/rest/SecureMLRestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
import java.util.Arrays;
import java.util.Map;

import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.message.BasicHeader;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;
import org.opensearch.client.RestClient;
import org.opensearch.commons.rest.SecureRestClientBuilder;
Expand All @@ -30,6 +33,7 @@
import org.opensearch.search.builder.SearchSourceBuilder;

import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;

public class SecureMLRestIT extends MLCommonsRestTestCase {
private String irisIndex = "iris_data_secure_ml_it";
Expand Down Expand Up @@ -57,6 +61,17 @@ public class SecureMLRestIT extends MLCommonsRestTestCase {

@Before
public void setup() throws IOException, ParseException {
Response response = TestHelper
.makeRequest(
client(),
"PUT",
"_cluster/settings",
null,
"{\"persistent\":{\"plugins.ml_commons.model_access_control_enabled\":true}}",
ImmutableList.of(new BasicHeader(HttpHeaders.USER_AGENT, ""))
);
assertEquals(200, response.getStatusLine().getStatusCode());

if (!isHttps()) {
throw new IllegalArgumentException("Secure Tests are running but HTTPS is not set");
}
Expand Down

0 comments on commit 37b36fb

Please sign in to comment.