Skip to content

Commit

Permalink
python_keywords: Change parsing container ID from a given CLI output
Browse files Browse the repository at this point in the history
The stdout in the neofs-cli was changed, so parsing container ID has been fixed
in the tests.

Old format:
container ID: 2tz86kVTDpJxWHrhw3h6PbKMwkLtBEwoqhHQCKTre1FN
awaiting...
container has been persisted on sidechain

New format:
container creation request accepted for processing (the operation may not be completed yet)
container ID: 2tz86kVTDpJxWHrhw3h6PbKMwkLtBEwoqhHQCKTre1FN
awaiting...
container has been persisted on sidechain

Signed-off-by: Oleg Kulachenko <[email protected]>
  • Loading branch information
vvarg229 committed Jun 20, 2023
1 parent d2ce378 commit 88e35d8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions robot/resources/lib/python_keywords/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def delete_container(
def _parse_cid(output: str) -> str:
"""
Parses container ID from a given CLI output. The input string we expect:
container creation request accepted for processing (the operation may not be completed yet)
container ID: 2tz86kVTDpJxWHrhw3h6PbKMwkLtBEwoqhHQCKTre1FN
awaiting...
container has been persisted on sidechain
Expand All @@ -218,14 +219,14 @@ def _parse_cid(output: str) -> str:
(str): extracted CID
"""
try:
# taking first line from command's output
first_line = output.split("\n")[0]
# taking second line from command's output
second_line = output.split("\n")[1]
except Exception:
first_line = ""
second_line = ""
logger.error(f"Got empty output: {output}")
splitted = first_line.split(": ")
splitted = second_line.split(": ")
if len(splitted) != 2:
raise ValueError(f"no CID was parsed from command output: \t{first_line}")
raise ValueError(f"no CID was parsed from command output: \t{second_line}")
return splitted[1]


Expand Down

0 comments on commit 88e35d8

Please sign in to comment.