Skip to content

Commit

Permalink
Added ISMTransform writeable test
Browse files Browse the repository at this point in the history
Signed-off-by: Tanqiu Liu <[email protected]>
  • Loading branch information
tanqiuliu committed Oct 7, 2023
1 parent 857abe5 commit 2f8c4d6
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package org.opensearch.indexmanagement.transform.model
import org.opensearch.common.io.stream.BytesStreamOutput
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.indexmanagement.transform.buildStreamInputForTransforms
import org.opensearch.indexmanagement.transform.randomISMTransform
import org.opensearch.indexmanagement.transform.randomTransform
import org.opensearch.indexmanagement.transform.randomTransformMetadata
import org.opensearch.test.OpenSearchTestCase
Expand Down Expand Up @@ -36,4 +37,11 @@ class WriteableTests : OpenSearchTestCase() {
@Suppress("DEPRECATION")
assertTrue("roles field in transform model is deprecated and should be parsed to empty list.", streamedTransform.roles.isEmpty())
}

fun `test ism transform as stream`() {
val ismTransform = randomISMTransform()
val out = BytesStreamOutput().also { ismTransform.writeTo(it) }
val streamedISMTransform = ISMTransform(buildStreamInputForTransforms(out))
assertEquals("Round tripping ISMTransform stream doesn't work", ismTransform, streamedISMTransform)
}
}

0 comments on commit 2f8c4d6

Please sign in to comment.