From 6eb8ea38dce5d0eb9a46f7eeff3b41fc9abd8bbe Mon Sep 17 00:00:00 2001 From: Ivo Yankov Date: Tue, 24 Oct 2023 13:13:09 +0300 Subject: [PATCH 1/2] fix: enable tests from suite Signed-off-by: Ivo Yankov --- .../misc/CannotDeleteSystemEntitiesSuite.java | 107 +++++++++++++++--- 1 file changed, 92 insertions(+), 15 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java index 57f0fb7a1031..0941a25303dd 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java @@ -58,21 +58,21 @@ public boolean canRunConcurrent() { public List getSpecsInSuite() { return List.of(new HapiSpec[] { ensureSystemAccountsHaveSomeFunds(), - systemUserCannotDeleteSystemAccounts(1, 100, GENESIS), - systemUserCannotDeleteSystemAccounts(700, 750, GENESIS), - systemUserCannotDeleteSystemAccounts(1, 100, SYSTEM_ADMIN), - systemUserCannotDeleteSystemAccounts(700, 750, SYSTEM_ADMIN), - systemUserCannotDeleteSystemAccounts(1, 100, SYSTEM_DELETE_ADMIN), - systemUserCannotDeleteSystemAccounts(700, 750, SYSTEM_DELETE_ADMIN), - normalUserCannotDeleteSystemAccounts(1, 100), - normalUserCannotDeleteSystemAccounts(700, 750), - systemUserCannotDeleteSystemFiles(sysFileIds, GENESIS), - systemUserCannotDeleteSystemFiles(sysFileIds, SYSTEM_ADMIN), - systemUserCannotDeleteSystemFiles(sysFileIds, SYSTEM_DELETE_ADMIN), - normalUserCannotDeleteSystemFiles(sysFileIds), - systemDeleteCannotDeleteSystemFiles(sysFileIds, GENESIS), - systemDeleteCannotDeleteSystemFiles(sysFileIds, SYSTEM_ADMIN), - systemDeleteCannotDeleteSystemFiles(sysFileIds, SYSTEM_DELETE_ADMIN) + genesisCannotDeleteSystemAccountsFrom1To100(), + genesisCannotDeleteSystemAccountsFrom700To750(), + systemAdminCannotDeleteSystemAccountsFrom1To100(), + systemAdminCannotDeleteSystemAccountsFrom700To750(), + systemDeleteAdminCannotDeleteSystemAccountsFrom1To100(), + systemDeleteAdminCannotDeleteSystemAccountsFrom700To750(), + normalUserCannotDeleteSystemAccountsFrom1To100(), + normalUserCannotDeleteSystemAccountsFrom700To750(), + genesisCannotDeleteSystemFileIds(), + systemAdminCannotDeleteSystemFileIds(), + systemDeleteAdminCannotDeleteSystemFileIds(), + normalUserCannotDeleteSystemFileIds(), + genesisCannotSystemFileDeleteFileIds(), + systemAdminCannotSystemFileDeleteFileIds(), + systemDeleteAdminCannotSystemFileDeleteFileIds() }); } @@ -88,6 +88,82 @@ private HapiSpec ensureSystemAccountsHaveSomeFunds() { .payingWith(GENESIS)); } + @HapiTest + private HapiSpec genesisCannotDeleteSystemAccountsFrom1To100() { + return systemUserCannotDeleteSystemAccounts(1, 100, GENESIS); + } + + @HapiTest + private HapiSpec genesisCannotDeleteSystemAccountsFrom700To750() { + return systemUserCannotDeleteSystemAccounts(700, 750, GENESIS); + } + + @HapiTest + private HapiSpec systemAdminCannotDeleteSystemAccountsFrom1To100() { + return systemUserCannotDeleteSystemAccounts(1, 100, SYSTEM_ADMIN); + } + + @HapiTest + private HapiSpec systemAdminCannotDeleteSystemAccountsFrom700To750() { + return systemUserCannotDeleteSystemAccounts(700, 750, SYSTEM_ADMIN); + } + + @HapiTest + private HapiSpec systemDeleteAdminCannotDeleteSystemAccountsFrom1To100() { + return systemUserCannotDeleteSystemAccounts(1, 100, SYSTEM_DELETE_ADMIN); + } + + @HapiTest + private HapiSpec systemDeleteAdminCannotDeleteSystemAccountsFrom700To750() { + return systemUserCannotDeleteSystemAccounts(700, 750, SYSTEM_DELETE_ADMIN); + } + + @HapiTest + private HapiSpec normalUserCannotDeleteSystemAccountsFrom1To100() { + return normalUserCannotDeleteSystemAccounts(1, 100); + } + + @HapiTest + private HapiSpec normalUserCannotDeleteSystemAccountsFrom700To750() { + return normalUserCannotDeleteSystemAccounts(700, 750); + } + + + @HapiTest + private HapiSpec genesisCannotDeleteSystemFileIds() { + return systemUserCannotDeleteSystemFiles(sysFileIds, GENESIS); + } + + @HapiTest + private HapiSpec systemAdminCannotDeleteSystemFileIds() { + return systemUserCannotDeleteSystemFiles(sysFileIds, SYSTEM_ADMIN); + } + + @HapiTest + private HapiSpec systemDeleteAdminCannotDeleteSystemFileIds() { + return systemUserCannotDeleteSystemFiles(sysFileIds, SYSTEM_DELETE_ADMIN); + } + + @HapiTest + private HapiSpec normalUserCannotDeleteSystemFileIds() { + return normalUserCannotDeleteSystemFiles(sysFileIds); + } + + @HapiTest + private HapiSpec genesisCannotSystemFileDeleteFileIds() { + return systemDeleteCannotDeleteSystemFiles(sysFileIds, GENESIS); + } + + @HapiTest + private HapiSpec systemAdminCannotSystemFileDeleteFileIds() { + return systemDeleteCannotDeleteSystemFiles(sysFileIds, SYSTEM_ADMIN); + } + + @HapiTest + private HapiSpec systemDeleteAdminCannotSystemFileDeleteFileIds() { + return systemDeleteCannotDeleteSystemFiles(sysFileIds, SYSTEM_DELETE_ADMIN); + } + private HapiSpec systemUserCannotDeleteSystemAccounts(int firstAccount, int lastAccount, String sysUser) { return defaultHapiSpec("systemUserCannotDeleteSystemAccounts") .given(cryptoCreate("unluckyReceiver").balance(0L)) @@ -114,6 +190,7 @@ private HapiSpec normalUserCannotDeleteSystemAccounts(int firstAccount, int last .toArray(HapiSpecOperation[]::new))); } + private HapiSpec systemUserCannotDeleteSystemFiles(int[] fileIds, String sysUser) { return defaultHapiSpec("systemUserCannotDeleteSystemFiles") .given() From b2bc1791c88ebc80dbad37265762bd3c80b068a7 Mon Sep 17 00:00:00 2001 From: Ivo Yankov Date: Tue, 24 Oct 2023 13:45:13 +0300 Subject: [PATCH 2/2] chore: spotless Signed-off-by: Ivo Yankov --- .../bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java index 0941a25303dd..7ca550c5da4f 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/misc/CannotDeleteSystemEntitiesSuite.java @@ -122,13 +122,12 @@ private HapiSpec systemDeleteAdminCannotDeleteSystemAccountsFrom700To750() { private HapiSpec normalUserCannotDeleteSystemAccountsFrom1To100() { return normalUserCannotDeleteSystemAccounts(1, 100); } - + @HapiTest private HapiSpec normalUserCannotDeleteSystemAccountsFrom700To750() { return normalUserCannotDeleteSystemAccounts(700, 750); } - @HapiTest private HapiSpec genesisCannotDeleteSystemFileIds() { return systemUserCannotDeleteSystemFiles(sysFileIds, GENESIS); @@ -190,7 +189,6 @@ private HapiSpec normalUserCannotDeleteSystemAccounts(int firstAccount, int last .toArray(HapiSpecOperation[]::new))); } - private HapiSpec systemUserCannotDeleteSystemFiles(int[] fileIds, String sysUser) { return defaultHapiSpec("systemUserCannotDeleteSystemFiles") .given()