Skip to content

Commit

Permalink
fix password argument in SecureRestClientBuilder constructor for Secu…
Browse files Browse the repository at this point in the history
…reWorkflowRestApiIT (opensearch-project#1041)

* fix password argument in SecureRestClientBuilder constructor for SecureWorkflowRestApiIT

Signed-off-by: Surya Sashank Nistala <[email protected]>

* fix tests to account for AUDIT alerts

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep authored Jul 17, 2023
1 parent 064e5f5 commit e4fae0e
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
fun create() {
if (userClient == null) {
createUser(user, arrayOf())
userClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), user, user).setSocketTimeout(60000).build()
userClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), user, password).setSocketTimeout(60000).build()
}
}

Expand Down Expand Up @@ -369,7 +369,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
listOf("role2"),
getClusterPermissionsFromCustomRole(ALERTING_GET_WORKFLOW_ACCESS)
)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, getUser)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, password)
.setSocketTimeout(60000).build()

val getWorkflowResponse = getUserClient?.makeRequest(
Expand Down Expand Up @@ -430,7 +430,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
)

val userWithDifferentRoleClient = SecureRestClientBuilder(
clusterHosts.toTypedArray(), isHttps(), userWithDifferentRole, userWithDifferentRole
clusterHosts.toTypedArray(), isHttps(), userWithDifferentRole, password
)
.setSocketTimeout(60000).build()

Expand Down Expand Up @@ -625,7 +625,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
listOf("role2"),
getClusterPermissionsFromCustomRole(ALERTING_GET_WORKFLOW_ACCESS)
)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, getUser)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, password)
.setSocketTimeout(60000).build()

val getWorkflowResponse = getUserClient?.makeRequest(
Expand Down Expand Up @@ -786,7 +786,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
listOf("role2"),
getClusterPermissionsFromCustomRole(ALERTING_GET_WORKFLOW_ACCESS)
)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, getUser)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, password)
.setSocketTimeout(60000).build()

val getWorkflowResponse = getUserClient?.makeRequest(
Expand Down Expand Up @@ -846,7 +846,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
false
)

val updateUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), updateUser, updateUser)
val updateUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), updateUser, password)
.setSocketTimeout(60000).build()
val updatedWorkflow = updateWorkflowWithClient(updateUserClient, createdWorkflow, listOf("role5"))

Expand Down Expand Up @@ -904,7 +904,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
listOf("role1", "role2"),
getClusterPermissionsFromCustomRole(ALERTING_GET_WORKFLOW_ACCESS)
)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, getUser)
val getUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), getUser, password)
.setSocketTimeout(60000).build()

val getWorkflowResponse = getUserClient?.makeRequest(
Expand Down Expand Up @@ -1074,7 +1074,7 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
getClusterPermissionsFromCustomRole(ALERTING_GET_WORKFLOW_ACCESS)
)
)
val deleteUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), deleteUser, deleteUser)
val deleteUserClient = SecureRestClientBuilder(clusterHosts.toTypedArray(), isHttps(), deleteUser, password)
.setSocketTimeout(60000).build()

try {
Expand Down Expand Up @@ -1407,10 +1407,10 @@ class SecureWorkflowRestApiIT : AlertingRestTestCase() {
try {
executeWorkflow(workflowId = workflowResponse.id)
val bucketAlerts = searchAlerts(bucketMonitor)
assertEquals("Incorrect number of alerts", 2, bucketAlerts.size)
assertEquals("Incorrect number of alerts", 0, bucketAlerts.size)

val docAlerts = searchAlerts(docMonitor)
assertEquals("Incorrect number of alerts", 1, docAlerts.size)
assertEquals("Incorrect number of alerts", 0, docAlerts.size)
} finally {
deleteRoleAndRoleMapping(TEST_HR_ROLE)
}
Expand Down

0 comments on commit e4fae0e

Please sign in to comment.