Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Lampe <[email protected]>
  • Loading branch information
blampe committed Jul 19, 2023
1 parent 9913387 commit 5122498
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

package org.opensearch.indexmanagement.rollup.util

import com.nhaarman.mockitokotlin2.doReturn
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
import org.opensearch.cluster.ClusterState
import org.opensearch.cluster.metadata.Metadata
import org.opensearch.index.query.BoolQueryBuilder
import org.opensearch.index.query.ConstantScoreQueryBuilder
import org.opensearch.index.query.DisMaxQueryBuilder
Expand Down Expand Up @@ -230,4 +235,16 @@ class RollupUtilsTests : OpenSearchTestCase() {
assertEquals("Rewritten aggregation builder is not the correct type", aggBuilder.type, rewrittenAgg.type)
}
}

fun `test isRollupIndex`() {
val indexName = "missing index"
val clusterState: ClusterState = mock()
val metadata: Metadata = mock()

whenever(clusterState.metadata).doReturn(metadata)
whenever(metadata.index(indexName)).doReturn(null)

val actual = isRollupIndex(indexName, clusterState)
assertFalse(actual)
}
}

0 comments on commit 5122498

Please sign in to comment.