Open DarshitChanpura opened 4 months ago
When running it twice with this command:
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="opensearch-cluster" -Dhttps=true -Duser=admin -Dpassword=<your-admin-password> --tests "org.opensearch.indexmanagement.IndexStateManagementSecurityBehaviorIT.test add policy"
Maybe this is not a bug?
What is the bug? While debugging the fix for https://github.com/opensearch-project/index-management/pull/1100, I ran into:
Upon further investigation, it was discovered that
IndexStateManagementSecurityBehaviorIT
is failing because of https://github.com/opensearch-project/index-management/blob/main/src/test/kotlin/org/opensearch/indexmanagement/SecurityRestTestCase.kt#L399 check inside SecurityRestTestCase.kt. If internal user doesn’t exist in the system then 201 CREATED is returned which is expected by the test. But, if internal user already exists then 200 OK is returned which is unexpected.This issue only occurs when tests are run more than once against an existing cluster. If the cluster is tore-down and re-started this issue will not occur. This is because the data is wiped with teardown.
How can one reproduce the bug? Steps to reproduce the behavior:
./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="opensearch-cluster" -Dhttps=true -Duser=admin -Dpassword=<your-admin-password>
What is the expected behavior? Maybe this isn't a bug as the test are not expected to be run against remote cluster twice without tearing the cluster down. But if it is expected to be run more than once, then the test should not fail.