From b032f6d447881d59bd3fc9f39162227d09220b52 Mon Sep 17 00:00:00 2001 From: "anatoly@nspcc.ru" Date: Wed, 2 Dec 2020 00:48:20 +0300 Subject: [PATCH] Update testcases by result of NeoFS bug fixing. --- .../lib/eacl/eacl_encoded_allow_all_pubkey | 14 ++-- robot/resources/lib/neofs.py | 6 +- robot/testsuites/integration/acl_bearer.robot | 58 +++++++++------- .../testsuites/integration/acl_extended.robot | 9 ++- .../integration/netmap_simple.robot | 69 +++++++++---------- .../integration/object_complex.robot | 13 ++-- 6 files changed, 83 insertions(+), 86 deletions(-) diff --git a/robot/resources/lib/eacl/eacl_encoded_allow_all_pubkey b/robot/resources/lib/eacl/eacl_encoded_allow_all_pubkey index 359f0e5..6c853ee 100755 --- a/robot/resources/lib/eacl/eacl_encoded_allow_all_pubkey +++ b/robot/resources/lib/eacl/eacl_encoded_allow_all_pubkey @@ -5,7 +5,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -14,7 +14,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -23,7 +23,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -32,7 +32,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -41,7 +41,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -50,7 +50,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, @@ -59,7 +59,7 @@ "action": "ALLOW", "targets": [ { - "keys": [ "NSNKmYXGM6TUH4AjAbtC2afxbJMV87XdDT" ] + "keys": [ "03db43cba61ef948a65c20b326b9409911341436478dfdd7472c9af6b10bb60000" ] } ] }, diff --git a/robot/resources/lib/neofs.py b/robot/resources/lib/neofs.py index 4ca9f09..5429b1e 100644 --- a/robot/resources/lib/neofs.py +++ b/robot/resources/lib/neofs.py @@ -24,7 +24,7 @@ CLI_PREFIX = "" @keyword('Form WIF from String') def form_wif_from_string(private_key: str): wif = "" - Cmd = f'neofs-cli util keyer -u {private_key}' + Cmd = f'neofs-cli util keyer {private_key}' logger.info("Cmd: %s" % Cmd) complProc = subprocess.run(Cmd, check=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=150, shell=True) @@ -171,7 +171,7 @@ def validate_storage_policy_for_object(private_key: str, expected_copies: int, c @keyword('Get eACL') -def get_eacl(private_key: bytes, cid: str): +def get_eacl(private_key: str, cid: str): Cmd = f'neofs-cli --rpc-endpoint {NEOFS_ENDPOINT} --key {private_key} container get-eacl --cid {cid}' logger.info("Cmd: %s" % Cmd) @@ -1005,7 +1005,7 @@ def _search_object(node:str, private_key: str, cid:str, oid: str): except subprocess.CalledProcessError as e: if re.search(r'local node is outside of object placement', e.output): - logger.warn("Server is not presented in container.") + logger.info("Server is not presented in container.") elif ( re.search(r'timed out after 30 seconds', e.output) or re.search(r'no route to host', e.output) ): logger.warn("Node is unavailable") diff --git a/robot/testsuites/integration/acl_bearer.robot b/robot/testsuites/integration/acl_bearer.robot index 6676b7f..7e0cd23 100644 --- a/robot/testsuites/integration/acl_bearer.robot +++ b/robot/testsuites/integration/acl_bearer.robot @@ -31,9 +31,9 @@ BearerToken Operations Check Bearer Check Container Inaccessible and Allow All Bearer Check eACL Deny and Allow All Bearer + Check eACL Deny and Allow All Bearer Filter OID Equal - # - # Check eACL Deny and Allow All Bearer Filter OID NotEqual + Check eACL Deny and Allow All Bearer Filter OID NotEqual @@ -210,26 +210,21 @@ Check eACL Deny and Allow All Bearer Filter OID Equal Run Keyword And Expect Error * ... Delete object ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY} - - - # https://github.com/nspcc-dev/neofs-node/issues/215 - + # Search is allowed without filter condition. Search object ${USER_KEY} ${CID} ${EMPTY} bearer_allow_all_user ${FILE_USR_HEADER} @{S_OBJ_H} - Run Keyword And Expect Error * ... Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} bearer_allow_all_user ${FILE_OTH_HEADER} - Run Keyword And Expect Error * ... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl + + # Preiodical issue: https://github.com/nspcc-dev/neofs-node/issues/225 + Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl + Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 - # TODO: Issue - observe and validate - Do not work and with allowed search operation! - # Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl - # Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 - - - #Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user - #Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user + # https://github.com/nspcc-dev/neofs-node/issues/215 + # Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + # Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user @@ -266,18 +261,31 @@ Check eACL Deny and Allow All Bearer Filter OID NotEqual Run Keyword And Expect Error * ... Delete object ${USER_KEY} ${CID} ${S_OID_USER} ${EMPTY} - # Search is allowed. - Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} bearer_allow_all_user ${FILE_OTH_HEADER} - Run Keyword And Expect Error * - ... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl - Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl - Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 + # Search is allowed without filter condition. Search object ${USER_KEY} ${CID} ${EMPTY} bearer_allow_all_user ${FILE_USR_HEADER} @{S_OBJ_H} - #Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user - #Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user - -# https://github.com/nspcc-dev/neofs-node/issues/215 + Put object to NeoFS ${USER_KEY} ${FILE_S} ${CID} bearer_allow_all_user ${FILE_OTH_HEADER} + + Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user local_file_eacl + Run Keyword And Expect Error * + ... Get object from NeoFS ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user local_file_eacl + + Get Range ${USER_KEY} ${CID} ${S_OID_USER} s_get_range bearer_allow_all_user 0:256 + Run Keyword And Expect Error * + ... Get Range ${USER_KEY} ${CID} ${S_OID_USER_2} s_get_range bearer_allow_all_user 0:256 + + Head object ${USER_KEY} ${CID} ${S_OID_USER} bearer_allow_all_user + Run Keyword And Expect Error * + ... Head object ${USER_KEY} ${CID} ${S_OID_USER_2} bearer_allow_all_user + + # https://github.com/nspcc-dev/neofs-node/issues/215 + # Delete object ${USER_KEY} ${CID} ${D_OID_USER} bearer_allow_all_user + # Run Keyword And Expect Error * + # ... Delete object ${USER_KEY} ${CID} ${D_OID_USER_2} bearer_allow_all_user + + + + #Check eACL Deny and Allow All Bearer Filter UserHeader Equal #Check eACL Deny and Allow All Bearer Filter UserHeader NotEqual #Check eACL Deny and Allow All Bearer for big object diff --git a/robot/testsuites/integration/acl_extended.robot b/robot/testsuites/integration/acl_extended.robot index d0098ab..26ec634 100644 --- a/robot/testsuites/integration/acl_extended.robot +++ b/robot/testsuites/integration/acl_extended.robot @@ -33,9 +33,8 @@ Check Actions Check eACL Deny and Allow All Other Check eACL Deny and Allow All User Check eACL Deny and Allow All System - - #https://github.com/nspcc-dev/neofs-node/issues/212 - #Check eACL Deny All Other and Allow All Pubkey + # Issue https://github.com/nspcc-dev/neofs-node/issues/224 + # Check eACL Deny All Other and Allow All Pubkey Check Filters @@ -288,8 +287,8 @@ Check eACL Deny All Other and Allow All Pubkey Get Range ${EACL_KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 Delete object ${EACL_KEY} ${CID} ${D_OID_USER} ${EMPTY} - Set eACL ${USER_KEY} ${CID} ${EACL_ALLOW_ALL_Pubkey} - Sleep ${MORPH_BLOCK_TIMEOUT} + Set eACL ${USER_KEY} ${CID} ${EACL_ALLOW_ALL_Pubkey} --await + Get eACL ${USER_KEY} ${CID} Run Keyword And Expect Error * ... Put object to NeoFS ${OTHER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER} diff --git a/robot/testsuites/integration/netmap_simple.robot b/robot/testsuites/integration/netmap_simple.robot index 4a78eef..98bbe76 100644 --- a/robot/testsuites/integration/netmap_simple.robot +++ b/robot/testsuites/integration/netmap_simple.robot @@ -15,60 +15,53 @@ NeoFS Simple Netmap Generate file - # https://github.com/nspcc-dev/neofs-api-go/issues/212 - # Validate Policy REP 2 IN X CBF 2 SELECT 2 FROM * AS X 2 @{EMPTY} + Validate Policy REP 2 IN X CBF 2 SELECT 2 FROM * AS X 2 @{EMPTY} - Validate Policy REP 2 IN X CBF 1 SELECT 2 FROM * AS X 2 @{EMPTY} + Validate Policy REP 2 IN X CBF 1 SELECT 2 FROM * AS X 2 @{EMPTY} - Validate Policy REP 3 IN X CBF 1 SELECT 3 FROM * AS X 3 @{EMPTY} + Validate Policy REP 3 IN X CBF 1 SELECT 3 FROM * AS X 3 @{EMPTY} - Validate Policy REP 1 IN X CBF 1 SELECT 1 FROM * AS X 1 @{EMPTY} + Validate Policy REP 1 IN X CBF 1 SELECT 1 FROM * AS X 1 @{EMPTY} - # https://github.com/nspcc-dev/neofs-api-go/issues/212 - # Validate Policy REP 1 IN X CBF 2 SELECT 1 FROM * AS X 1 @{EMPTY} + Validate Policy REP 1 IN X CBF 2 SELECT 1 FROM * AS X 1 @{EMPTY} - Validate Policy REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EMPTY} + Validate Policy REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EMPTY} - Validate Policy REP 2 IN X CBF 1 SELECT 4 FROM * AS X 2 @{EMPTY} + Validate Policy REP 2 IN X CBF 1 SELECT 4 FROM * AS X 2 @{EMPTY} - @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 - Validate Policy REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EXPECTED} + @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 + Validate Policy REP 4 IN X CBF 1 SELECT 4 FROM * AS X 4 @{EXPECTED} - @{EXPECTED} = Create List s03.neofs.devenv:8080 - Validate Policy REP 1 IN LOC_PLACE CBF 1 SELECT 1 FROM LOC_SW AS LOC_PLACE FILTER Country EQ Sweden AS LOC_SW 1 @{EXPECTED} + @{EXPECTED} = Create List s03.neofs.devenv:8080 + Validate Policy REP 1 IN LOC_PLACE CBF 1 SELECT 1 FROM LOC_SW AS LOC_PLACE FILTER Country EQ Sweden AS LOC_SW 1 @{EXPECTED} - @{EXPECTED} = Create List s02.neofs.devenv:8080 - Validate Policy REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER City EQ 'Saint-Petersburg' AS LOC_SPB 1 @{EXPECTED} + @{EXPECTED} = Create List s02.neofs.devenv:8080 + Validate Policy REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER City EQ 'Saint-Petersburg' AS LOC_SPB 1 @{EXPECTED} + @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 + Validate Policy REP 1 IN LOC_SPB_PLACE REP 1 IN LOC_MSK_PLACE CBF 1 SELECT 1 FROM LOC_SPB AS LOC_SPB_PLACE SELECT 1 FROM LOC_MSK AS LOC_MSK_PLACE FILTER City EQ 'Saint-Petersburg' AS LOC_SPB FILTER City EQ 'Moscow' AS LOC_MSK 2 @{EXPECTED} - # https://github.com/nspcc-dev/neofs-api-go/issues/215 - # @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - # Validate Policy REP 1 IN LOC_SPB_PLACE REP 1 IN LOC_MSK_PLACE CBF 1 SELECT 1 FROM LOC_SPB AS LOC_SPB_PLACE SELECT 1 FROM LOC_MSK AS LOC_MSK_PLACE FILTER City EQ 'Saint-Petersburg' AS LOC_SPB FILTER City EQ 'Moscow' AS LOC_MSK 2 @{EXPECTED} + @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 + Validate Policy REP 4 CBF 1 SELECT 4 FROM LOC_EU FILTER Location EQ Europe AS LOC_EU 4 @{EXPECTED} - # https://github.com/nspcc-dev/neofs-api-go/issues/213 - # @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 s03.neofs.devenv:8080 s04.neofs.devenv:8080 - # Validate Policy REP 4 CBF 1 SELECT 4 FROM LOC_EU FILTER Location EQ Europe AS LOC_EU 4 @{EXPECTED} + @{EXPECTED} = Create List s02.neofs.devenv:8080 + Validate Policy REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER City NE 'Moscow' AND City NE 'Stockholm' AND City NE 'Helsinki' AS LOC_SPB 1 @{EXPECTED} - @{EXPECTED} = Create List s02.neofs.devenv:8080 - Validate Policy REP 1 CBF 1 SELECT 1 FROM LOC_SPB FILTER City NE 'Moscow' AND City NE 'Stockholm' AND City NE 'Helsinki' AS LOC_SPB 1 @{EXPECTED} + @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 + Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER City NE 'Stockholm' AND City NE 'Helsinki' AS LOC_RU 2 @{EXPECTED} - # https://github.com/nspcc-dev/neofs-api-go/issues/213 - # @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - # Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER City NE 'Stockholm' AND City NE 'Helsinki' AS LOC_RU 2 @{EXPECTED} + @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 + Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER Country EQ 'Russia' AS LOC_RU 2 @{EXPECTED} - - # https://github.com/nspcc-dev/neofs-api-go/issues/214 - # @{EXPECTED} = Create List s01.neofs.devenv:8080 s02.neofs.devenv:8080 - # Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_RU FILTER Country EQ 'Russia' AS LOC_RU 2 @{EXPECTED} - - # https://github.com/nspcc-dev/neofs-api-go/issues/214 - # @{EXPECTED} = Create List s03.neofs.devenv:8080 s04.neofs.devenv:8080 - # Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_EU FILTER Country NE 'Russia' AS LOC_EU 2 @{EXPECTED} - # Log Operation should be failed with container rule "RF 1 SELECT 6 Node" - # ${CID} = Create container ${PRIV_KEY} ${EMPTY} RF 1 SELECT 6 Node + @{EXPECTED} = Create List s03.neofs.devenv:8080 s04.neofs.devenv:8080 + Validate Policy REP 2 CBF 1 SELECT 2 FROM LOC_EU FILTER Country NE 'Russia' AS LOC_EU 2 @{EXPECTED} + + Log Put operation should be failed with error "not enough nodes to SELECT from: 'X'" + Run Keyword And Expect Error * + ... Validate Policy REP 2 IN X CBF 2 SELECT 6 FROM * AS X 2 @{EMPTY} -*** Keywords *** +*** Keywords *** Generate file @@ -111,5 +104,5 @@ Validate Policy Container Existing ${PRIV_KEY} ${CID} ${S_OID} = Put object to NeoFS ${PRIV_KEY} ${FILE} ${CID} ${EMPTY} ${EMPTY} Validate storage policy for object ${PRIV_KEY} ${EXPECTED_VAL} ${CID} ${S_OID} @{EXPECTED_LIST} - # Can be on each of nodes + diff --git a/robot/testsuites/integration/object_complex.robot b/robot/testsuites/integration/object_complex.robot index 57f2172..6f9dc5f 100644 --- a/robot/testsuites/integration/object_complex.robot +++ b/robot/testsuites/integration/object_complex.robot @@ -10,7 +10,7 @@ ${FILE_USR_HEADER_OTH} = key1=2 *** Test cases *** -NeoFS Simple Object Operations +NeoFS Complex Object Operations [Documentation] Testcase to validate NeoFS operations with simple object. [Tags] Object NeoFS NeoCLI [Timeout] 20 min @@ -60,16 +60,14 @@ NeoFS Simple Object Operations # @{Full_obj_list} = Create List @{Link_obj_S} @{Link_obj_H} ${S_OID} ${H_OID} # Search object ${PRIV_KEY} ${CID} ${EMPTY} ${EMPTY} @{Full_obj_list} - Run Keyword And Expect Error * - ... Search object ${PRIV_KEY} ${CID} ${EMPTY} ${EMPTY} ${EMPTY} @{S_OBJ_ALL} - - - @{S_OBJ_ALL} = Create List ${S_OID} ${H_OID} ${H_OID_OTH} @{S_OBJ_H} = Create List ${H_OID} @{S_OBJ_H_OTH} = Create List ${H_OID_OTH} + Run Keyword And Expect Error * + ... Search object ${PRIV_KEY} ${CID} ${EMPTY} ${EMPTY} ${EMPTY} @{S_OBJ_ALL} + Get object from NeoFS ${PRIV_KEY} ${CID} ${S_OID} ${EMPTY} s_file_read Get object from NeoFS ${PRIV_KEY} ${CID} ${H_OID} ${EMPTY} h_file_read @@ -106,8 +104,7 @@ NeoFS Simple Object Operations Cleanup File s_get_range Cleanup File h_get_range -# 4.86192020 - +