Skip to content

Commit

Permalink
rename the fake credential in IT
Browse files Browse the repository at this point in the history
Signed-off-by: Xun Zhang <[email protected]>
  • Loading branch information
Zhangxunmt committed Jan 10, 2024
1 parent deb51f6 commit 6119319
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
30 changes: 15 additions & 15 deletions plugin/src/test/java/org/opensearch/ml/rest/MLModelGroupRestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class MLModelGroupRestIT extends MLCommonsRestTestCase {
public ExpectedException exceptionRule = ExpectedException.none();

private String modelGroupId;
private String password = "IntegTest@MLModelGroupRestIT123";
private String fakePw = "IntegTest@MLModelGroupRestIT123";

public void disableModelAccessControl(boolean isSecurityEnabled) throws IOException {
Response response = TestHelper
Expand Down Expand Up @@ -101,38 +101,38 @@ public void setup() throws IOException {
}
createSearchRole(indexSearchAccessRole, "*");

createUser(mlNoAccessUser, password, ImmutableList.of(opensearchBackendRole));
mlNoAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlNoAccessUser, password)
createUser(mlNoAccessUser, fakePw, ImmutableList.of(opensearchBackendRole));
mlNoAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlNoAccessUser, fakePw)
.setSocketTimeout(60000)
.build();

createUser(mlReadOnlyUser, password, ImmutableList.of(opensearchBackendRole));
mlReadOnlyClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlReadOnlyUser, password)
createUser(mlReadOnlyUser, fakePw, ImmutableList.of(opensearchBackendRole));
mlReadOnlyClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlReadOnlyUser, fakePw)
.setSocketTimeout(60000)
.build();

createUser(mlFullAccessUser, password, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlFullAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlFullAccessUser, password)
createUser(mlFullAccessUser, fakePw, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlFullAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlFullAccessUser, fakePw)
.setSocketTimeout(60000)
.build();

createUser(user1, password, ImmutableList.of("IT", "HR"));
user1Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user1, password)
createUser(user1, fakePw, ImmutableList.of("IT", "HR"));
user1Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user1, fakePw)
.setSocketTimeout(60000)
.build();

createUser(user2, password, ImmutableList.of("IT"));
user2Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user2, password)
createUser(user2, fakePw, ImmutableList.of("IT"));
user2Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user2, fakePw)
.setSocketTimeout(60000)
.build();

createUser(user3, password, ImmutableList.of("Finance"));
user3Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user3, password)
createUser(user3, fakePw, ImmutableList.of("Finance"));
user3Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user3, fakePw)
.setSocketTimeout(60000)
.build();

createUser(user4, password, ImmutableList.of());
user4Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user4, password)
createUser(user4, fakePw, ImmutableList.of());
user4Client = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), user4, fakePw)
.setSocketTimeout(60000)
.build();

Expand Down
18 changes: 9 additions & 9 deletions plugin/src/test/java/org/opensearch/ml/rest/SecureMLRestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class SecureMLRestIT extends MLCommonsRestTestCase {
public ExpectedException exceptionRule = ExpectedException.none();

private String modelGroupId;
private String password = "IntegTest@SecureMLRestIT123";
private String fakePw = "IntegTest@SecureMLRestIT123";

@Before
public void setup() throws IOException, ParseException {
Expand All @@ -78,26 +78,26 @@ public void setup() throws IOException, ParseException {
}
createSearchRole(indexSearchAccessRole, "*");

createUser(mlNoAccessUser, password, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlNoAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlNoAccessUser, password)
createUser(mlNoAccessUser, fakePw, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlNoAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlNoAccessUser, fakePw)
.setSocketTimeout(60000)
.build();

createUser(mlReadOnlyUser, password, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlReadOnlyClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlReadOnlyUser, password)
createUser(mlReadOnlyUser, fakePw, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlReadOnlyClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlReadOnlyUser, fakePw)
.setSocketTimeout(60000)
.build();

createUser(mlFullAccessNoIndexAccessUser, password, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
createUser(mlFullAccessNoIndexAccessUser, fakePw, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlFullAccessNoIndexAccessClient = new SecureRestClientBuilder(
getClusterHosts().toArray(new HttpHost[0]),
isHttps(),
mlFullAccessNoIndexAccessUser,
password
fakePw
).setSocketTimeout(60000).build();

createUser(mlFullAccessUser, password, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlFullAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlFullAccessUser, password)
createUser(mlFullAccessUser, fakePw, new ArrayList<>(Arrays.asList(opensearchBackendRole)));
mlFullAccessClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[0]), isHttps(), mlFullAccessUser, fakePw)
.setSocketTimeout(60000)
.build();

Expand Down

0 comments on commit 6119319

Please sign in to comment.