forked from opensearch-project/index-management
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue651 tests (opensearch-project#1046)
* Implemented filtering on the ISM eplain API Signed-off-by: Joshua Au <[email protected]> * Fixed tests for ExplainRequest Signed-off-by: Joshua Au <[email protected]> * Added filtering on query and metadata map Signed-off-by: Joshua Au <[email protected]> * Filtered on indexNames in metadata Signed-off-by: Joshua Au <[email protected]> * Fixed github workflow check errors Signed-off-by: Joshua Au <[email protected]> * Removed debugging comments Signed-off-by: Joshua Au <[email protected]> * Updated code styling to make more clear Signed-off-by: Joshua Au <[email protected]> * Refactored code to match suggestions Signed-off-by: Joshua Au <[email protected]> * Added test case for the ExplainFilter.byMetaData and parse methods Signed-off-by: Joshua Au <[email protected]> * Started implementation of explain filter IT Signed-off-by: Joshua Au <[email protected]> * Implemented test explain filter method Signed-off-by: Joshua Au <[email protected]> * Implemented explain filter test on failure Signed-off-by: Joshua Au <[email protected]> * Cleaned up log statements Signed-off-by: Joshua Au <[email protected]> * Added explain filter test for success Signed-off-by: Joshua Au <[email protected]> * Fixed lint errors Signed-off-by: Joshua Au <[email protected]> * Removed policy from index to fix flaky tests Signed-off-by: Joshua Au <[email protected]> --------- Signed-off-by: Joshua Au <[email protected]> Signed-off-by: bowenlan-amzn <[email protected]> Co-authored-by: bowenlan-amzn <[email protected]>
- Loading branch information
1 parent
6e787fa
commit e47aff8
Showing
7 changed files
with
356 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...st/kotlin/org/opensearch/indexmanagement/indexstatemanagement/model/ExplainFilterTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.indexstatemanagement.model | ||
|
||
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.ActionMetaData | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.ManagedIndexMetaData | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.PolicyRetryInfoMetaData | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.StateMetaData | ||
import org.opensearch.test.OpenSearchTestCase | ||
|
||
class ExplainFilterTests : OpenSearchTestCase() { | ||
fun `test byMetadata`() { | ||
val stateMetaData = StateMetaData("state", 100) | ||
val actionMetaData = ActionMetaData("action", null, 0, false, 0, null, null) | ||
val policyRetryInfoMetaData = PolicyRetryInfoMetaData(false, 1) | ||
|
||
val managedIndexMetaDataAllNull = ManagedIndexMetaData("test", "indexUuid", "policy_id", null, null, null, null, null, null, null, null, null, null, null) | ||
val managedIndexMetaDataNonNull = ManagedIndexMetaData("test", "indexUuid", "policy_id", null, null, null, null, null, null, stateMetaData, actionMetaData, null, policyRetryInfoMetaData, null) | ||
val managedIndexMetaDataSomeNull = ManagedIndexMetaData("test", "indexUuid", "policy_id", null, null, null, null, null, null, null, actionMetaData, null, null, null) | ||
|
||
val explainFilter = ExplainFilter(state = "state", actionType = "action", failed = false) | ||
|
||
var res = explainFilter.byMetaData(managedIndexMetaDataAllNull) | ||
assertFalse(res) | ||
|
||
res = explainFilter.byMetaData(managedIndexMetaDataNonNull) | ||
assertTrue(res) | ||
|
||
res = explainFilter.byMetaData(managedIndexMetaDataSomeNull) | ||
assertFalse(res) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.