Skip to content

Commit 8d7c76f

Browse files
Resolve invalid map with raw json in BasicReplicationIT.kt (#1537)
Co-authored-by: Mohit Kumar <[email protected]>
1 parent 9225d8d commit 8d7c76f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ task integTestRemote (type: RestIntegTestTask) {
948948
systemProperty "tests.cluster.followCluster.total_nodes", "${-> numberOfNodes.toString()}"
949949
systemProperty "tests.cluster.leaderCluster.total_nodes", "${-> numberOfNodes.toString()}"
950950
systemProperty "build.dir", "${buildDir}"
951+
systemProperty "tests.security.manager", "false"
951952

952953
}
953954
filter {

scripts/integtest.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ then
143143
# Get number of nodes, assuming both leader and follower have same number of nodes
144144
numNodes=$((${follower_port} - ${leader_port}))
145145
echo "numNodes: $numNodes"
146-
echo './gradlew integTestRemote -Dleader.http_host='"$leader_endpoint:$leader_port"' -Dfollower.http_host='"$follower_endpoint:$follower_port"' -Dfollower.transport_host='"$follower_endpoint:$follower_transport"' -Dleader.transport_host='"$leader_endpoint:$leader_transport"' -Dsecurity_enabled='"$SECURITY_ENABLED"' -Duser='"$USERNAME"' -Dpassword='"$PASSWORD"' -PnumNodes='"$numNodes"' --console=plain'
147-
./gradlew integTestRemote -Dleader.http_host=$leader_endpoint:$leader_port -Dfollower.http_host=$follower_endpoint:$follower_port -Dfollower.transport_host=$follower_endpoint:$follower_transport -Dleader.transport_host=$leader_endpoint:$leader_transport -Dsecurity_enabled=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD -PnumNodes=$numNodes --console=plain
146+
echo './gradlew --no-daemon integTestRemote -Dleader.http_host='"$leader_endpoint:$leader_port"' -Dfollower.http_host='"$follower_endpoint:$follower_port"' -Dfollower.transport_host='"$follower_endpoint:$follower_transport"' -Dleader.transport_host='"$leader_endpoint:$leader_transport"' -Dsecurity_enabled='"$SECURITY_ENABLED"' -Duser='"$USERNAME"' -Dpassword='"$PASSWORD"' -PnumNodes='"$numNodes"' --console=plain'
147+
./gradlew --no-daemon integTestRemote -Dleader.http_host=$leader_endpoint:$leader_port -Dfollower.http_host=$follower_endpoint:$follower_port -Dfollower.transport_host=$follower_endpoint:$follower_transport -Dleader.transport_host=$leader_endpoint:$leader_transport -Dsecurity_enabled=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD -PnumNodes=$numNodes --console=plain
148148

149149
else
150150
# Single cluster
@@ -153,4 +153,4 @@ else
153153
TRANSPORT_PORT="9300"
154154
fi
155155
./gradlew singleClusterSanityTest -Dfollower.http_host="$BIND_ADDRESS:$BIND_PORT" -Dfollower.transport_host="$BIND_ADDRESS:$TRANSPORT_PORT" -Dsecurity_enabled=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD --console=plain
156-
fi
156+
fi

src/test/kotlin/org/opensearch/replication/BasicReplicationIT.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {
116116
followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName), waitForRestore=true)
117117
// Create document
118118
var source = mapOf("my_vector1" to listOf(2.5,3.5) , "price" to 7.1)
119-
var response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(source), RequestOptions.DEFAULT)
119+
var jsonSource = "{\"my_vector1\":[2.5,3.5],\"price\":7.1}"
120+
var response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
120121
assertThat(response.result).withFailMessage("Failed to create leader data").isEqualTo(Result.CREATED)
121122
assertBusy({
122123
val getResponse = followerClient.get(GetRequest(followerIndexName, "1"), RequestOptions.DEFAULT)
@@ -126,7 +127,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {
126127

127128
// Update document
128129
source = mapOf("my_vector1" to listOf(3.5,4.5) , "price" to 12.9)
129-
response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(source), RequestOptions.DEFAULT)
130+
jsonSource = "{\"my_vector1\":[3.5,4.5],\"price\":12.9}"
131+
response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
130132
assertThat(response.result).withFailMessage("Failed to update leader data").isEqualTo(Result.UPDATED)
131133
assertBusy({
132134
val getResponse = followerClient.get(GetRequest(followerIndexName, "1"), RequestOptions.DEFAULT)
@@ -138,7 +140,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {
138140
PutMappingRequest(leaderIndexName).source(KNN_INDEX_MAPPING1, XContentType.JSON) , RequestOptions.DEFAULT
139141
)
140142
source = mapOf("my_vector3" to listOf(3.1,4.5,5.7,8.9) , "price" to 17.9)
141-
response = leaderClient.index(IndexRequest(leaderIndexName).id("2").source(source), RequestOptions.DEFAULT)
143+
jsonSource = "{\"my_vector3\":[3.1,4.5,5.7,8.9],\"price\":17.9}"
144+
response = leaderClient.index(IndexRequest(leaderIndexName).id("2").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
142145
assertThat(response.result).withFailMessage("Failed to update leader data").isEqualTo(Result.CREATED)
143146
assertBusy({
144147
val getResponse = followerClient.get(GetRequest(followerIndexName, "2"), RequestOptions.DEFAULT)

0 commit comments

Comments
 (0)