Skip to content

Resolve invalid map with raw json in BasicReplicationIT.kt #1537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ task integTestRemote (type: RestIntegTestTask) {
systemProperty "tests.cluster.followCluster.total_nodes", "${-> numberOfNodes.toString()}"
systemProperty "tests.cluster.leaderCluster.total_nodes", "${-> numberOfNodes.toString()}"
systemProperty "build.dir", "${buildDir}"
systemProperty "tests.security.manager", "false"

}
filter {
Expand Down
6 changes: 3 additions & 3 deletions scripts/integtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ then
# Get number of nodes, assuming both leader and follower have same number of nodes
numNodes=$((${follower_port} - ${leader_port}))
echo "numNodes: $numNodes"
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'
./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
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'
./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

else
# Single cluster
Expand All @@ -153,4 +153,4 @@ else
TRANSPORT_PORT="9300"
fi
./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
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {
followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName), waitForRestore=true)
// Create document
var source = mapOf("my_vector1" to listOf(2.5,3.5) , "price" to 7.1)
var response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(source), RequestOptions.DEFAULT)
var jsonSource = "{\"my_vector1\":[2.5,3.5],\"price\":7.1}"
var response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
assertThat(response.result).withFailMessage("Failed to create leader data").isEqualTo(Result.CREATED)
assertBusy({
val getResponse = followerClient.get(GetRequest(followerIndexName, "1"), RequestOptions.DEFAULT)
Expand All @@ -126,7 +127,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {

// Update document
source = mapOf("my_vector1" to listOf(3.5,4.5) , "price" to 12.9)
response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(source), RequestOptions.DEFAULT)
jsonSource = "{\"my_vector1\":[3.5,4.5],\"price\":12.9}"
response = leaderClient.index(IndexRequest(leaderIndexName).id("1").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
assertThat(response.result).withFailMessage("Failed to update leader data").isEqualTo(Result.UPDATED)
assertBusy({
val getResponse = followerClient.get(GetRequest(followerIndexName, "1"), RequestOptions.DEFAULT)
Expand All @@ -138,7 +140,8 @@ class BasicReplicationIT : MultiClusterRestTestCase() {
PutMappingRequest(leaderIndexName).source(KNN_INDEX_MAPPING1, XContentType.JSON) , RequestOptions.DEFAULT
)
source = mapOf("my_vector3" to listOf(3.1,4.5,5.7,8.9) , "price" to 17.9)
response = leaderClient.index(IndexRequest(leaderIndexName).id("2").source(source), RequestOptions.DEFAULT)
jsonSource = "{\"my_vector3\":[3.1,4.5,5.7,8.9],\"price\":17.9}"
response = leaderClient.index(IndexRequest(leaderIndexName).id("2").source(jsonSource, XContentType.JSON), RequestOptions.DEFAULT)
assertThat(response.result).withFailMessage("Failed to update leader data").isEqualTo(Result.CREATED)
assertBusy({
val getResponse = followerClient.get(GetRequest(followerIndexName, "2"), RequestOptions.DEFAULT)
Expand Down
Loading