From 406ee36b154b007f144b3316c4fe13db2e7c3ad2 Mon Sep 17 00:00:00 2001 From: Nick Knize Date: Tue, 5 Apr 2022 06:25:45 -0500 Subject: [PATCH] Fix TaskInfo serialization and unmute task_list bwc test (#2766) Fixes the version check around resourceStats serialization and unmutes the failing bwc test. Signed-off-by: Nicholas Walter Knize --- .../main/resources/rest-api-spec/test/tasks.list/10_basic.yml | 2 -- server/src/main/java/org/opensearch/tasks/TaskInfo.java | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/tasks.list/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/tasks.list/10_basic.yml index b1f2e084295..fd6bb7f96eb 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/tasks.list/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/tasks.list/10_basic.yml @@ -1,8 +1,6 @@ --- "tasks_list test": - skip: - version: "all" - reason: "AwaitsFix https://github.com/opensearch-project/OpenSearch/issues/2757" features: [arbitrary_key] - do: diff --git a/server/src/main/java/org/opensearch/tasks/TaskInfo.java b/server/src/main/java/org/opensearch/tasks/TaskInfo.java index e6ba94a71b6..b6814282b5d 100644 --- a/server/src/main/java/org/opensearch/tasks/TaskInfo.java +++ b/server/src/main/java/org/opensearch/tasks/TaskInfo.java @@ -142,7 +142,7 @@ public final class TaskInfo implements Writeable, ToXContentFragment { } parentTaskId = TaskId.readFromStream(in); headers = in.readMap(StreamInput::readString, StreamInput::readString); - if (in.getVersion().onOrAfter(Version.V_2_0_0)) { + if (in.getVersion().onOrAfter(Version.V_2_1_0)) { resourceStats = in.readOptionalWriteable(TaskResourceStats::new); } else { resourceStats = null; @@ -164,7 +164,7 @@ public final class TaskInfo implements Writeable, ToXContentFragment { } parentTaskId.writeTo(out); out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString); - if (out.getVersion().onOrAfter(Version.V_2_0_0)) { + if (out.getVersion().onOrAfter(Version.V_2_1_0)) { out.writeOptionalWriteable(resourceStats); } }