From be9a1aca902ad0573af4d0d5eace896edc992a4b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 19 Sep 2022 21:34:14 +0400 Subject: [PATCH] [#315] apistatus: Support `NodeUnderMaintenance` in `FromStatusV2` Support decoding `NodeUnderMaintenance` status errors in `FromStatusV2` function. From now `NodeUnderMaintenance` instance can be decoded from `status.Status` message of NeoFS API V2 protocol. Signed-off-by: Leonard Lyubich --- client/status/v2.go | 2 ++ client/status/v2_test.go | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/client/status/v2.go b/client/status/v2.go index d9bc019..5978efe 100644 --- a/client/status/v2.go +++ b/client/status/v2.go @@ -58,6 +58,8 @@ func FromStatusV2(st *status.Status) Status { decoder = new(WrongMagicNumber) case status.SignatureVerificationFail: decoder = new(SignatureVerification) + case status.NodeUnderMaintenance: + decoder = new(NodeUnderMaintenance) } case object.LocalizeFailStatus(&code): switch code { diff --git a/client/status/v2_test.go b/client/status/v2_test.go index 5e1e5ae..8615bb9 100644 --- a/client/status/v2_test.go +++ b/client/status/v2_test.go @@ -125,6 +125,12 @@ func TestToStatusV2(t *testing.T) { }), codeV2: 4097, }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.NodeUnderMaintenance) + }), + codeV2: 1027, + }, } { var st apistatus.Status @@ -272,6 +278,12 @@ func TestFromStatusV2(t *testing.T) { }), codeV2: 4097, }, + { + status: (statusConstructor)(func() apistatus.Status { + return new(apistatus.NodeUnderMaintenance) + }), + codeV2: 1027, + }, } { var st apistatus.Status