From 5d9e85dc33271b57f91e183f4db78920f44696a0 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 14:45:06 +0545 Subject: [PATCH 1/6] run tests Signed-off-by: Saw-jan --- .woodpecker.star | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 8935401ebf..29689c1dd9 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -519,16 +519,7 @@ def main(ctx): ) test_pipelines = \ - codestyle(ctx) + \ - checkGherkinLint(ctx) + \ - checkTestSuitesInExpectedFailures(ctx) + \ - pipelinesDependsOn(buildWebCache(ctx), savePipelineNumber(ctx)) + \ - pipelinesDependsOn(cacheBrowsers(ctx), savePipelineNumber(ctx)) + \ - getGoBinForTesting(ctx) + \ pipelinesDependsOn(buildOpencloudBinaryForTesting(ctx), savePipelineNumber(ctx)) + \ - checkStarlark(ctx) + \ - build_release_helpers + \ - testOpencloudAndUploadResults(ctx) + \ testPipelines(ctx) build_release_pipelines = \ @@ -672,10 +663,10 @@ def testPipelines(ctx): pipelines += wopiValidatorTests(ctx, storage, "builtin", "default") pipelines += wopiValidatorTests(ctx, storage, "cs3", "default") - pipelines += localApiTestPipeline(ctx) + pipelines = localApiTestPipeline(ctx) pipelines += coreApiTestPipeline(ctx) - pipelines += e2eTestPipeline(ctx) - pipelines += multiServiceE2ePipeline(ctx) + # pipelines += e2eTestPipeline(ctx) + # pipelines += multiServiceE2ePipeline(ctx) if ("skip" not in config["k6LoadTests"] or not config["k6LoadTests"]["skip"]) and ("k6-test" in ctx.build.title.lower() or ctx.build.event == "cron"): pipelines += pipelineDependsOn(k6LoadTests(ctx), savePipelineNumber(ctx)) @@ -1218,7 +1209,7 @@ def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty = def localApiTestPipeline(ctx): pipelines = [] - with_remote_php = [True] + with_remote_php = [True, False] enable_watch_fs = [False] if ctx.build.event == "cron": with_remote_php.append(False) @@ -1381,6 +1372,7 @@ def coreApiTestPipeline(ctx): if "[decomposed]" in ctx.build.title.lower(): params["storages"] = ["decomposed"] + params["withRemotePhp"] = [True, False] if ctx.build.event == "cron": params["withRemotePhp"] = [True, False] params["enableWatchFs"] = [True, False] From 9f2d820aebf400350e104da0af39e8498fdf7e8b Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 15:43:43 +0545 Subject: [PATCH 2/6] ci: override with-remote-php config if specified Signed-off-by: Saw-jan --- .woodpecker.star | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 29689c1dd9..104ceb40ef 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -1209,12 +1209,6 @@ def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty = def localApiTestPipeline(ctx): pipelines = [] - with_remote_php = [True, False] - enable_watch_fs = [False] - if ctx.build.event == "cron": - with_remote_php.append(False) - enable_watch_fs.append(True) - defaults = { "suites": {}, "skip": False, @@ -1228,8 +1222,8 @@ def localApiTestPipeline(ctx): "federationServer": False, "collaborationServiceNeeded": False, "extraCollaborationEnvironment": {}, - "withRemotePhp": with_remote_php, - "enableWatchFs": enable_watch_fs, + "withRemotePhp": [True], + "enableWatchFs": [False], "ldapNeeded": False, "generateVirusFiles": False, } @@ -1246,6 +1240,14 @@ def localApiTestPipeline(ctx): if "[decomposed]" in ctx.build.title.lower() or name.startswith("cli"): params["storages"] = ["decomposed"] + if ctx.build.event == "cron": + params["withRemotePhp"] = [True, False] + params["enableWatchFs"] = [True, False] + + # override withRemotePhp if specified in the suite config + if "withRemotePhp" in matrix: + params["withRemotePhp"] = matrix["withRemotePhp"] + for storage in params["storages"]: for run_with_remote_php in params["withRemotePhp"]: for run_with_watch_fs_enabled in params["enableWatchFs"]: @@ -1377,6 +1379,10 @@ def coreApiTestPipeline(ctx): params["withRemotePhp"] = [True, False] params["enableWatchFs"] = [True, False] + # override withRemotePhp if specified in the suite config + if "withRemotePhp" in matrix: + params["withRemotePhp"] = matrix["withRemotePhp"] + debugParts = params["skipExceptParts"] debugPartsEnabled = (len(debugParts) != 0) From 5270d47e0d1f37e5c641fe828327bc539ae4c3a2 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 15:54:57 +0545 Subject: [PATCH 3/6] debug Signed-off-by: Saw-jan --- .woodpecker.star | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.star b/.woodpecker.star index 104ceb40ef..ad698450c0 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -1240,6 +1240,7 @@ def localApiTestPipeline(ctx): if "[decomposed]" in ctx.build.title.lower() or name.startswith("cli"): params["storages"] = ["decomposed"] + params["withRemotePhp"] = [True, False] if ctx.build.event == "cron": params["withRemotePhp"] = [True, False] params["enableWatchFs"] = [True, False] From ce2f2a8577159824eb2f9fd42d735e5ad0a9c3b2 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 15:58:28 +0545 Subject: [PATCH 4/6] test: update expected-failures list Signed-off-by: Saw-jan --- tests/acceptance/expected-failures-without-remotephp.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/acceptance/expected-failures-without-remotephp.md b/tests/acceptance/expected-failures-without-remotephp.md index f95ac80d79..a3bcf868cb 100644 --- a/tests/acceptance/expected-failures-without-remotephp.md +++ b/tests/acceptance/expected-failures-without-remotephp.md @@ -201,9 +201,9 @@ - [apiAntivirus/antivirus.feature:143](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L143) - [apiAntivirus/antivirus.feature:144](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L144) - [apiAntivirus/antivirus.feature:145](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L145) -- [apiAntivirus/antivirus.feature:356](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L356) - [apiAntivirus/antivirus.feature:357](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L357) - [apiAntivirus/antivirus.feature:358](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L358) +- [apiAntivirus/antivirus.feature:359](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAntivirus/antivirus.feature#L359) - [apiCollaboration/wopi.feature:956](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiCollaboration/wopi.feature#L956) - [apiCollaboration/wopi.feature:957](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiCollaboration/wopi.feature#L957) - [apiCollaboration/wopi.feature:958](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiCollaboration/wopi.feature#L958) @@ -320,7 +320,6 @@ - [coreApiWebdavUploadTUS/uploadFile.feature:122](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L122) - [coreApiWebdavUploadTUS/uploadFile.feature:133](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L133) - [coreApiWebdavUploadTUS/uploadFile.feature:146](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L146) -- [coreApiWebdavUploadTUS/uploadFile.feature:168](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L168) - [coreApiWebdavUploadTUS/uploadFile.feature:187](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L187) - [coreApiWebdavUploadTUS/uploadFile.feature:199](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L199) - [coreApiWebdavUploadTUS/uploadFile.feature:212](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L212) From 33d9abc8ae3c2a77644994ca81072aea5d075ff0 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 16:59:46 +0545 Subject: [PATCH 5/6] test: remove accountHashDifficulty test suite Signed-off-by: Saw-jan --- .woodpecker.star | 36 +++-------- tests/acceptance/config/behat.yml | 21 +----- .../expected-failures-decomposed-storage.md | 2 - .../expected-failures-posix-storage.md | 2 - .../apiAccountsHashDifficulty/addUser.feature | 16 ----- .../assignRole.feature | 64 ------------------- .../createShareToSharesFolder.feature | 18 ------ .../uploadFile.feature | 21 ------ .../webDavPUTAuthInvalid.feature | 31 --------- tests/acceptance/scripts/run_api_tests.sh | 1 - 10 files changed, 12 insertions(+), 200 deletions(-) delete mode 100644 tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature delete mode 100644 tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature delete mode 100644 tests/acceptance/features/apiAccountsHashDifficulty/createShareToSharesFolder.feature delete mode 100644 tests/acceptance/features/apiAccountsHashDifficulty/uploadFile.feature delete mode 100644 tests/acceptance/features/apiAccountsHashDifficulty/webDavPUTAuthInvalid.feature diff --git a/.woodpecker.star b/.woodpecker.star index ad698450c0..e2b319036a 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -201,13 +201,6 @@ config = { ], "skip": False, }, - "accountsHashDifficulty": { - "skip": False, - "suites": [ - "apiAccountsHashDifficulty", - ], - "accounts_hash_difficulty": "default", - }, "notification": { "suites": [ "apiNotification", @@ -658,10 +651,10 @@ def testPipelines(ctx): storage = "decomposed" if "skip" not in config["cs3ApiTests"] or not config["cs3ApiTests"]["skip"]: - pipelines += cs3ApiTests(ctx, storage, "default") + pipelines += cs3ApiTests(ctx, storage) if "skip" not in config["wopiValidatorTests"] or not config["wopiValidatorTests"]["skip"]: - pipelines += wopiValidatorTests(ctx, storage, "builtin", "default") - pipelines += wopiValidatorTests(ctx, storage, "cs3", "default") + pipelines += wopiValidatorTests(ctx, storage, "builtin") + pipelines += wopiValidatorTests(ctx, storage, "cs3") pipelines = localApiTestPipeline(ctx) pipelines += coreApiTestPipeline(ctx) @@ -1050,12 +1043,12 @@ def codestyle(ctx): return pipelines -def cs3ApiTests(ctx, storage, accounts_hash_difficulty = 4): +def cs3ApiTests(ctx, storage): pipeline = { "name": "test-cs3-API-%s" % storage, "steps": evaluateWorkflowStep() + restoreBuildArtifactCache(ctx, dirs["opencloudBinArtifact"], dirs["opencloudBinPath"]) + - opencloudServer(storage, accounts_hash_difficulty, deploy_type = "cs3api_validator") + + opencloudServer(storage, deploy_type = "cs3api_validator") + [ { "name": "cs3ApiTests", @@ -1086,7 +1079,7 @@ def cs3ApiTests(ctx, storage, accounts_hash_difficulty = 4): ]) return [pipeline] -def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty = 4): +def wopiValidatorTests(ctx, storage, wopiServerType): testgroups = [ "BaseWopiViewing", "CheckFileInfoSchema", @@ -1164,7 +1157,7 @@ def wopiValidatorTests(ctx, storage, wopiServerType, accounts_hash_difficulty = "steps": evaluateWorkflowStep() + restoreBuildArtifactCache(ctx, dirs["opencloudBinArtifact"], dirs["opencloudBinPath"]) + waitForServices("fake-office", ["fakeoffice:8080"]) + - opencloudServer(storage, accounts_hash_difficulty, deploy_type = "wopi_validator", extra_server_environment = extra_server_environment) + + opencloudServer(storage, deploy_type = "wopi_validator", extra_server_environment = extra_server_environment) + wopiServer + waitForServices("wopi-fakeoffice", ["wopi-fakeoffice:9300"]) + [ @@ -1215,7 +1208,6 @@ def localApiTestPipeline(ctx): "extraTestEnvironment": {}, "extraServerEnvironment": {}, "storages": ["posix"], - "accounts_hash_difficulty": 4, "emailNeeded": False, "antivirusNeeded": False, "tikaNeeded": False, @@ -1273,13 +1265,12 @@ def localApiTestPipeline(ctx): (waitForLdapService() if params["ldapNeeded"] else []) + opencloudServer( storage, - params["accounts_hash_difficulty"], extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"], watch_fs_enabled = run_with_watch_fs_enabled, ) + - (opencloudServer(storage, params["accounts_hash_difficulty"], deploy_type = "federation", extra_server_environment = params["extraServerEnvironment"], watch_fs_enabled = run_with_watch_fs_enabled) if params["federationServer"] else []) + + (opencloudServer(storage, deploy_type = "federation", extra_server_environment = params["extraServerEnvironment"], watch_fs_enabled = run_with_watch_fs_enabled) if params["federationServer"] else []) + ((wopiCollaborationService("fakeoffice") + wopiCollaborationService("collabora") + wopiCollaborationService("onlyoffice")) if params["collaborationServiceNeeded"] else []) + (openCloudHealthCheck("wopi", ["wopi-collabora:9304", "wopi-onlyoffice:9304", "wopi-fakeoffice:9304"]) if params["collaborationServiceNeeded"] else []) + localApiTest(params["suites"], storage, params["extraTestEnvironment"], run_with_remote_php, params["generateVirusFiles"]) + @@ -1358,7 +1349,6 @@ def coreApiTestPipeline(ctx): "numberOfParts": 7, "skipExceptParts": [], "skip": False, - "accounts_hash_difficulty": 4, } pipelines = [] @@ -1405,7 +1395,6 @@ def coreApiTestPipeline(ctx): restoreBuildArtifactCache(ctx, dirs["opencloudBinArtifact"], dirs["opencloudBinPath"]) + opencloudServer( storage, - params["accounts_hash_difficulty"], with_wrapper = True, watch_fs_enabled = run_with_watch_fs_enabled, ) + @@ -2323,7 +2312,7 @@ def notifyMatrix(ctx): return result -def opencloudServer(storage = "decomposed", accounts_hash_difficulty = 4, depends_on = [], deploy_type = "", extra_server_environment = {}, with_wrapper = False, tika_enabled = False, watch_fs_enabled = False): +def opencloudServer(storage = "decomposed", depends_on = [], deploy_type = "", extra_server_environment = {}, with_wrapper = False, tika_enabled = False, watch_fs_enabled = False): user = "0:0" container_name = OC_SERVER_NAME environment = { @@ -2419,13 +2408,6 @@ def opencloudServer(storage = "decomposed", accounts_hash_difficulty = 4, depend if watch_fs_enabled: environment["STORAGE_USERS_POSIX_WATCH_FS"] = True - # Pass in "default" accounts_hash_difficulty to not set this environment variable. - # That will allow OpenCloud to use whatever its built-in default is. - # Otherwise pass in a value from 4 to about 11 or 12 (default 4, for making regular tests fast) - # The high values cause lots of CPU to be used when hashing passwords, and really slow down the tests. - if accounts_hash_difficulty != "default": - environment["ACCOUNTS_HASH_DIFFICULTY"] = accounts_hash_difficulty - for item in extra_server_environment: environment[item] = extra_server_environment[item] diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 7894cc1880..1cbbe49187 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -3,9 +3,9 @@ default: "": "%paths.base%/../bootstrap" suites: - apiAccountsHashDifficulty: + apiSpaces: paths: - - "%paths.base%/../features/apiAccountsHashDifficulty" + - "%paths.base%/../features/apiSpaces" context: &common_ldap_suite_context parameters: ldapAdminPassword: admin @@ -18,21 +18,6 @@ default: adminPassword: admin regularUserPassword: 123456 - SettingsContext: - - GraphContext: - - SpacesContext: - - CapabilitiesContext: - - FilesVersionsContext: - - NotificationContext: - - OCSContext: - - PublicWebDavContext: - - apiSpaces: - paths: - - "%paths.base%/../features/apiSpaces" - context: *common_ldap_suite_context - contexts: - - FeatureContext: *common_feature_context_params - - SettingsContext: - SpacesContext: - CapabilitiesContext: - FilesVersionsContext: @@ -442,7 +427,7 @@ default: - AuthAppContext: - CliContext: - OcConfigContext: - + apiTenancy: paths: - "%paths.base%/../features/apiTenancy" diff --git a/tests/acceptance/expected-failures-decomposed-storage.md b/tests/acceptance/expected-failures-decomposed-storage.md index 11384990e6..1fd60d34f2 100644 --- a/tests/acceptance/expected-failures-decomposed-storage.md +++ b/tests/acceptance/expected-failures-decomposed-storage.md @@ -19,8 +19,6 @@ #### [Settings service user can list other peoples assignments](https://github.com/owncloud/ocis/issues/5032) -- [apiAccountsHashDifficulty/assignRole.feature:27](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature#L27) -- [apiAccountsHashDifficulty/assignRole.feature:28](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature#L28) - [apiGraph/getAssignedRole.feature:31](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L31) - [apiGraph/getAssignedRole.feature:32](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L32) - [apiGraph/getAssignedRole.feature:33](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L33) diff --git a/tests/acceptance/expected-failures-posix-storage.md b/tests/acceptance/expected-failures-posix-storage.md index bf72df4d16..93feeadc6b 100644 --- a/tests/acceptance/expected-failures-posix-storage.md +++ b/tests/acceptance/expected-failures-posix-storage.md @@ -19,8 +19,6 @@ #### [Settings service user can list other peoples assignments](https://github.com/owncloud/ocis/issues/5032) -- [apiAccountsHashDifficulty/assignRole.feature:27](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature#L27) -- [apiAccountsHashDifficulty/assignRole.feature:28](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature#L28) - [apiGraph/getAssignedRole.feature:31](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L31) - [apiGraph/getAssignedRole.feature:32](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L32) - [apiGraph/getAssignedRole.feature:33](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiGraph/getAssignedRole.feature#L33) diff --git a/tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature b/tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature deleted file mode 100644 index ca9218fe81..0000000000 --- a/tests/acceptance/features/apiAccountsHashDifficulty/addUser.feature +++ /dev/null @@ -1,16 +0,0 @@ -@skipOnReva -Feature: add user - As an admin - I want to be able to add users and store their password with the full hash difficulty - So that I can give people controlled individual access to resources on the OpenCloud server - - - Scenario: admin creates a user - When the user "Admin" creates a new user with the following attributes using the Graph API: - | userName | brand-new-user | - | displayName | Brand New User | - | email | new@example.org | - | password | %alt1% | - Then the HTTP status code should be "201" - And user "brand-new-user" should exist - And user "brand-new-user" should be able to upload file "filesForUpload/lorem.txt" to "lorem.txt" diff --git a/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature b/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature deleted file mode 100644 index 4154cb2ca9..0000000000 --- a/tests/acceptance/features/apiAccountsHashDifficulty/assignRole.feature +++ /dev/null @@ -1,64 +0,0 @@ -Feature: assign role - As an admin, - I want to assign roles to users - So that I can provide them different authority - - - Scenario Outline: only admin user can see all existing roles - Given user "Alice" has been created with default attributes - And the administrator has given "Alice" the role "" using the settings api - When user "Alice" tries to get all existing roles using the settings API - Then the HTTP status code should be "" - Examples: - | user-role | http-status-code | - | Admin | 201 | - | Space Admin | 201 | - | User | 201 | - - @issue-5032 - Scenario Outline: only admin user can see assignments list - Given user "Alice" has been created with default attributes - And the administrator has given "Alice" the role "" using the settings api - When user "Alice" tries to get list of assignment using the settings API - Then the HTTP status code should be "" - Examples: - | user-role | http-status-code | - | Admin | 201 | - | Space Admin | 401 | - | User | 401 | - - - Scenario Outline: a user cannot change own role - Given user "Alice" has been created with default attributes - And the administrator has given "Alice" the role "" using the settings api - When user "Alice" changes his own role to "" - Then the HTTP status code should be "400" - And user "Alice" should have the role "" - Examples: - | user-role | desired-role | - | Admin | User | - | Admin | Space Admin | - | Space Admin | Admin | - | Space Admin | Space Admin | - | User | Admin | - | User | Space Admin | - - - Scenario Outline: only admin user can change the role for another user - Given these users have been created with default attributes: - | username | - | Alice | - | Brian | - And the administrator has given "Alice" the role "" using the settings api - When user "Alice" changes the role "" for user "Brian" - Then the HTTP status code should be "" - And user "Brian" should have the role "" - Examples: - | user-role | desired-role | http-status-code | expected-role | - | Admin | User | 201 | User | - | Admin | Space Admin | 201 | Space Admin | - | Admin | Admin | 201 | Admin | - | Space Admin | Admin | 400 | User | - | Space Admin | Space Admin | 400 | User | - | User | Admin | 400 | User | - | User | Space Admin | 400 | User | diff --git a/tests/acceptance/features/apiAccountsHashDifficulty/createShareToSharesFolder.feature b/tests/acceptance/features/apiAccountsHashDifficulty/createShareToSharesFolder.feature deleted file mode 100644 index d774757b51..0000000000 --- a/tests/acceptance/features/apiAccountsHashDifficulty/createShareToSharesFolder.feature +++ /dev/null @@ -1,18 +0,0 @@ -@skipOnReva -Feature: sharing - As a user - I want to be able to share files when passwords are stored with the full hash difficulty - So that I can give people secure controlled access to my data - - - Scenario Outline: creating a share of a file with a user - Given using OCS API version "" - And user "Alice" has been created with default attributes - And user "Alice" has uploaded file with content "OpenCloud test text file 0" to "/textfile0.txt" - And user "Brian" has been created with default attributes - When user "Alice" shares file "textfile0.txt" with user "Brian" using the sharing API - And the content of file "/Shares/textfile0.txt" for user "Brian" should be "OpenCloud test text file 0" - Examples: - | ocs-api-version | - | 1 | - | 2 | diff --git a/tests/acceptance/features/apiAccountsHashDifficulty/uploadFile.feature b/tests/acceptance/features/apiAccountsHashDifficulty/uploadFile.feature deleted file mode 100644 index b043ded69e..0000000000 --- a/tests/acceptance/features/apiAccountsHashDifficulty/uploadFile.feature +++ /dev/null @@ -1,21 +0,0 @@ -@skipOnReva -Feature: upload file - As a user - I want to be able to upload files when passwords are stored with the full hash difficulty - So that I can store and share files securely between multiple client systems - - - Scenario Outline: upload a file and check download content - Given using OCS API version "" - And user "Alice" has been created with default attributes - And using DAV path - When user "Alice" uploads file with content "uploaded content" to "/upload.txt" using the WebDAV API - Then the content of file "/upload.txt" for user "Alice" should be "uploaded content" - Examples: - | ocs-api-version | dav-path-version | - | 1 | old | - | 1 | new | - | 1 | spaces | - | 2 | old | - | 2 | new | - | 2 | spaces | diff --git a/tests/acceptance/features/apiAccountsHashDifficulty/webDavPUTAuthInvalid.feature b/tests/acceptance/features/apiAccountsHashDifficulty/webDavPUTAuthInvalid.feature deleted file mode 100644 index 7d7ca85f69..0000000000 --- a/tests/acceptance/features/apiAccountsHashDifficulty/webDavPUTAuthInvalid.feature +++ /dev/null @@ -1,31 +0,0 @@ -@skipOnReva -Feature: attempt to PUT files with invalid password - As an admin - I want the system to be secure when passwords are stored with the full hash difficulty - So that unauthorised users do not have access to data - - Background: - Given user "Alice" has been created with default attributes - And user "Alice" has created folder "/PARENT" - - - Scenario: send PUT requests to webDav endpoints as normal user with wrong password - When user "Alice" requests these endpoints with "PUT" including body "doesnotmatter" using password "invalid" about user "Alice" - | endpoint | - | /webdav/textfile0.txt | - | /dav/files/%username%/textfile0.txt | - | /webdav/PARENT | - | /dav/files/%username%/PARENT | - | /dav/files/%username%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "401" - - - Scenario: send PUT requests to webDav endpoints as normal user with no password - When user "Alice" requests these endpoints with "PUT" including body "doesnotmatter" using password "" about user "Alice" - | endpoint | - | /webdav/textfile0.txt | - | /dav/files/%username%/textfile0.txt | - | /webdav/PARENT | - | /dav/files/%username%/PARENT | - | /dav/files/%username%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "401" diff --git a/tests/acceptance/scripts/run_api_tests.sh b/tests/acceptance/scripts/run_api_tests.sh index 9a7068c356..fc310a5409 100755 --- a/tests/acceptance/scripts/run_api_tests.sh +++ b/tests/acceptance/scripts/run_api_tests.sh @@ -64,7 +64,6 @@ SUITES=( "apiSharingNgShareInvitation" "apiSharingNgLinkSharePermission" "apiSharingNgLinkShareRoot" - "apiAccountsHashDifficulty" "apiSearchContent" "apiNotification" ) From a4654644448f9ed99d4828d92c30887a5fed6dd8 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Jan 2026 17:52:50 +0545 Subject: [PATCH 6/6] test: auto-generate virus fils before test run Signed-off-by: Saw-jan --- .woodpecker.star | 12 +----- tests/README.md | 9 ---- .../TestHelpers/HttpRequestHelper.php | 6 +-- tests/acceptance/TestHelpers/UploadHelper.php | 15 +++++-- .../acceptance/bootstrap/ChecksumContext.php | 3 +- tests/acceptance/bootstrap/FeatureContext.php | 42 +++++++++++++++---- .../bootstrap/PublicWebDavContext.php | 5 ++- tests/acceptance/bootstrap/TUSContext.php | 5 ++- tests/acceptance/bootstrap/WebDav.php | 8 ++-- .../cliCommands/uploadSessions.feature | 8 ++-- .../scripts/generate-virus-files.sh | 19 --------- tests/acceptance/scripts/run.sh | 1 - 12 files changed, 66 insertions(+), 67 deletions(-) delete mode 100755 tests/acceptance/scripts/generate-virus-files.sh diff --git a/.woodpecker.star b/.woodpecker.star index e2b319036a..c3477e05e3 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -227,7 +227,6 @@ config = { ], "skip": False, "antivirusNeeded": True, - "generateVirusFiles": True, "extraServerEnvironment": { "ANTIVIRUS_SCANNER_TYPE": "clamav", "ANTIVIRUS_CLAMAV_SOCKET": "tcp://clamav:3310", @@ -294,7 +293,6 @@ config = { "skip": False, "withRemotePhp": [True], "antivirusNeeded": True, - "generateVirusFiles": True, "extraServerEnvironment": { "ANTIVIRUS_SCANNER_TYPE": "clamav", "ANTIVIRUS_CLAMAV_SOCKET": "tcp://clamav:3310", @@ -1217,7 +1215,6 @@ def localApiTestPipeline(ctx): "withRemotePhp": [True], "enableWatchFs": [False], "ldapNeeded": False, - "generateVirusFiles": False, } if "localApiTests" in config: @@ -1273,7 +1270,7 @@ def localApiTestPipeline(ctx): (opencloudServer(storage, deploy_type = "federation", extra_server_environment = params["extraServerEnvironment"], watch_fs_enabled = run_with_watch_fs_enabled) if params["federationServer"] else []) + ((wopiCollaborationService("fakeoffice") + wopiCollaborationService("collabora") + wopiCollaborationService("onlyoffice")) if params["collaborationServiceNeeded"] else []) + (openCloudHealthCheck("wopi", ["wopi-collabora:9304", "wopi-onlyoffice:9304", "wopi-fakeoffice:9304"]) if params["collaborationServiceNeeded"] else []) + - localApiTest(params["suites"], storage, params["extraTestEnvironment"], run_with_remote_php, params["generateVirusFiles"]) + + localApiTest(params["suites"], storage, params["extraTestEnvironment"], run_with_remote_php) + logRequests(), "services": (emailService() if params["emailNeeded"] else []) + (clamavService() if params["antivirusNeeded"] else []) + @@ -1297,7 +1294,7 @@ def localApiTestPipeline(ctx): pipelines.append(pipeline) return pipelines -def localApiTest(suites, storage = "decomposed", extra_environment = {}, with_remote_php = False, generate_virus_files = False): +def localApiTest(suites, storage = "decomposed", extra_environment = {}, with_remote_php = False): test_dir = "%s/tests/acceptance" % dirs["base"] expected_failures_file = "%s/expected-failures-%s-storage.md" % (test_dir, storage) @@ -1322,11 +1319,6 @@ def localApiTest(suites, storage = "decomposed", extra_environment = {}, with_re commands = [] - # Generate EICAR virus test files if needed - if generate_virus_files: - commands.append("chmod +x %s/tests/acceptance/scripts/generate-virus-files.sh" % dirs["base"]) - commands.append("bash %s/tests/acceptance/scripts/generate-virus-files.sh" % dirs["base"]) - # Merge expected failures if not with_remote_php: commands.append("cat %s/expected-failures-without-remotephp.md >> %s" % (test_dir, expected_failures_file)) diff --git a/tests/README.md b/tests/README.md index fa290e93c3..04df56e24f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -466,15 +466,6 @@ For antivirus running localy on Linux OS, use `ANTIVIRUS_CLAMAV_SOCKET= "/var/ru For antivirus running localy on Mac OS, use `ANTIVIRUS_CLAMAV_SOCKET= "/tmp/clamd.sock"`. For antivirus running with docker, use `ANTIVIRUS_CLAMAV_SOCKET= "tcp://host.docker.internal:3310"` -#### Create Virus Files - -The antivirus tests require EICAR test files which are not stored in the repository -They are generated dynamically when needed for testing. - -```bash -tests/acceptance/scripts/generate-virus-files.sh -``` - #### Run the Acceptance Test Run the acceptance test with the following command: diff --git a/tests/acceptance/TestHelpers/HttpRequestHelper.php b/tests/acceptance/TestHelpers/HttpRequestHelper.php index 60b6486029..f36ecea49a 100644 --- a/tests/acceptance/TestHelpers/HttpRequestHelper.php +++ b/tests/acceptance/TestHelpers/HttpRequestHelper.php @@ -62,7 +62,7 @@ public static function numRetriesOnHttpTooEarly(): int { /** * - * @param string|null $url + * @param string $url * @param string|null $xRequestId * @param string|null $method * @param string|null $user @@ -80,8 +80,8 @@ public static function numRetriesOnHttpTooEarly(): int { * @throws GuzzleException */ public static function sendRequestOnce( - ?string $url, - ?string $xRequestId, + string $url, + ?string $xRequestId = null, ?string $method = 'GET', ?string $user = null, ?string $password = null, diff --git a/tests/acceptance/TestHelpers/UploadHelper.php b/tests/acceptance/TestHelpers/UploadHelper.php index 52fe8fef98..66d05f1e94 100644 --- a/tests/acceptance/TestHelpers/UploadHelper.php +++ b/tests/acceptance/TestHelpers/UploadHelper.php @@ -195,13 +195,20 @@ public static function createFileWithText(?string $name, ?string $text): void { } /** - * get the path of a file from FilesForUpload directory + * get the path of the acceptance tests directory * - * @param string|null $name name of the file to upload + * @return string + */ + public static function getAcceptanceTestsDir(): string { + return \dirname(__FILE__) . "/../"; + } + + /** + * get the path of the filesForUpload directory * * @return string */ - public static function getUploadFilesDir(?string $name): string { - return \getenv("FILES_FOR_UPLOAD") . $name; + public static function getFilesForUploadDir(): string { + return \dirname(__FILE__) . "/../filesForUpload/"; } } diff --git a/tests/acceptance/bootstrap/ChecksumContext.php b/tests/acceptance/bootstrap/ChecksumContext.php index 50a6d58f79..8d5183d9ff 100644 --- a/tests/acceptance/bootstrap/ChecksumContext.php +++ b/tests/acceptance/bootstrap/ChecksumContext.php @@ -25,6 +25,7 @@ use Psr\Http\Message\ResponseInterface; use TestHelpers\WebDavHelper; use TestHelpers\BehatHelper; +use TestHelpers\UploadHelper; require_once 'bootstrap.php'; @@ -49,7 +50,7 @@ public function uploadFileToWithChecksumUsingTheAPI( string $checksum ): ResponseInterface { $file = \file_get_contents( - $this->featureContext->acceptanceTestsDirLocation() . $source + UploadHelper::getAcceptanceTestsDir() . $source ); return $this->featureContext->makeDavRequest( $user, diff --git a/tests/acceptance/bootstrap/FeatureContext.php b/tests/acceptance/bootstrap/FeatureContext.php index a5cf981a4a..a5e843e683 100644 --- a/tests/acceptance/bootstrap/FeatureContext.php +++ b/tests/acceptance/bootstrap/FeatureContext.php @@ -43,6 +43,7 @@ use TestHelpers\SettingsHelper; use TestHelpers\OcConfigHelper; use TestHelpers\BehatHelper; +use TestHelpers\UploadHelper; use Swaggest\JsonSchema\InvalidValue as JsonSchemaException; use Swaggest\JsonSchema\Exception\ArrayException; use Swaggest\JsonSchema\Exception\ConstException; @@ -562,6 +563,38 @@ public static function setupLogDir(BeforeSuiteScope $scope): void { } } + /** + * @BeforeScenario @antivirus + * + * @return void + * @throws Exception + */ + public function createTestVirusFiles(): void { + $uploadDir = UploadHelper::getFilesForUploadDir() . 'filesWithVirus/'; + $virusFile = $uploadDir . 'eicar.com'; + $virusZipFile = $uploadDir . 'eicar_com.zip'; + + if (file_exists($virusFile) && file_exists($virusZipFile)) { + return; + } + + if (!is_dir($uploadDir)) { + mkdir($uploadDir, 0755); + } + + $res1 = HttpRequestHelper::sendRequestOnce('https://secure.eicar.org/eicar.com'); + if ($res1->getStatusCode() !== 200) { + throw new Exception("Could not download eicar.com test virus file"); + } + file_put_contents($virusFile, $res1->getBody()->getContents()); + + $res2 = HttpRequestHelper::sendRequestOnce('https://secure.eicar.org/eicar_com.zip'); + file_put_contents($virusZipFile, $res2->getBody()->getContents()); + if ($res2->getStatusCode() !== 200) { + throw new Exception("Could not download eicar_com.zip test virus file"); + } + } + /** * * @BeforeScenario @@ -2596,18 +2629,11 @@ public function temporaryStorageSubfolderName(): string { return "work_tmp"; } - /** - * @return string - */ - public function acceptanceTestsDirLocation(): string { - return \dirname(__FILE__) . "/../"; - } - /** * @return string */ public function workStorageDirLocation(): string { - return $this->acceptanceTestsDirLocation() . $this->temporaryStorageSubfolderName() . "/"; + return UploadHelper::getAcceptanceTestsDir() . $this->temporaryStorageSubfolderName() . "/"; } /** diff --git a/tests/acceptance/bootstrap/PublicWebDavContext.php b/tests/acceptance/bootstrap/PublicWebDavContext.php index b6fc3583c4..968ca3e43b 100644 --- a/tests/acceptance/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/bootstrap/PublicWebDavContext.php @@ -26,6 +26,7 @@ use TestHelpers\HttpRequestHelper; use TestHelpers\WebDavHelper; use TestHelpers\BehatHelper; +use TestHelpers\UploadHelper; require_once 'bootstrap.php'; @@ -862,7 +863,7 @@ public function thePublicUploadsFileToInsideLastLinkSharedFolderUsingThePublicWe string $destination, ): void { $content = \file_get_contents( - $this->featureContext->acceptanceTestsDirLocation() . $source + UploadHelper::getAcceptanceTestsDir() . $source ); $response = $this->publicUploadContent( $destination, @@ -888,7 +889,7 @@ public function thePublicUploadsFileToInsideLastLinkSharedFolderWithPasswordUsin string $password ): void { $content = \file_get_contents( - $this->featureContext->acceptanceTestsDirLocation() . $source + UploadHelper::getAcceptanceTestsDir() . $source ); $response = $this->publicUploadContent( $destination, diff --git a/tests/acceptance/bootstrap/TUSContext.php b/tests/acceptance/bootstrap/TUSContext.php index 425555c6ef..6e6d208e6b 100644 --- a/tests/acceptance/bootstrap/TUSContext.php +++ b/tests/acceptance/bootstrap/TUSContext.php @@ -32,6 +32,7 @@ use TestHelpers\HttpRequestHelper; use TestHelpers\WebDavHelper; use TestHelpers\BehatHelper; +use TestHelpers\UploadHelper; require_once 'bootstrap.php'; @@ -364,7 +365,7 @@ public function uploadFileUsingTus( $client->setChecksumAlgorithm('sha1'); $client->setApiPath(WebDavHelper::getDavPath($davPathVersion, $suffixPath)); $client->setMetadata($uploadMetadata); - $sourceFile = $this->featureContext->acceptanceTestsDirLocation() . $source; + $sourceFile = UploadHelper::getAcceptanceTestsDir() . $source; $client->setKey((string)rand())->file($sourceFile, $destination); $this->featureContext->pauseUploadDelete(); @@ -518,7 +519,7 @@ public function userUploadsFileWithContentToWithMtimeUsingTUS( */ public function writeDataToTempFile(string $content): string { $temporaryFileName = \tempnam( - $this->featureContext->acceptanceTestsDirLocation(), + UploadHelper::getAcceptanceTestsDir(), "tus-upload-test-" ); if ($temporaryFileName === false) { diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 033501b6cf..b4c3ab2e8d 100644 --- a/tests/acceptance/bootstrap/WebDav.php +++ b/tests/acceptance/bootstrap/WebDav.php @@ -1648,7 +1648,7 @@ public function uploadFile( ?bool $isGivenStep = false ): ResponseInterface { $user = $this->getActualUsername($user); - $file = \fopen($this->acceptanceTestsDirLocation() . $source, 'r'); + $file = \fopen(UploadHelper::getAcceptanceTestsDir() . $source, 'r'); $this->pauseUploadDelete(); $response = $this->makeDavRequest( $user, @@ -1781,7 +1781,7 @@ public function userUploadsAFileInChunk( } return $this->uploadFileWithHeaders( $user, - $this->acceptanceTestsDirLocation() . $source, + UploadHelper::getAcceptanceTestsDir() . $source, $destination, $headers, $noOfChunks @@ -2222,7 +2222,7 @@ public function userUploadsFileToWithMtimeUsingTheWebdavApi( $this->getBaseUrl(), $user, $this->getPasswordForUser($user), - $this->acceptanceTestsDirLocation() . $source, + UploadHelper::getAcceptanceTestsDir() . $source, $destination, $this->getStepLineRef(), ["X-OC-Mtime" => $mtime], @@ -2257,7 +2257,7 @@ public function userHasUploadedFileToWithMtimeUsingTheWebdavApi( $this->getBaseUrl(), $user, $this->getPasswordForUser($user), - $this->acceptanceTestsDirLocation() . $source, + UploadHelper::getAcceptanceTestsDir() . $source, $destination, $this->getStepLineRef(), ["X-OC-Mtime" => $mtime], diff --git a/tests/acceptance/features/cliCommands/uploadSessions.feature b/tests/acceptance/features/cliCommands/uploadSessions.feature index 169cd095ac..4def4cecb3 100644 --- a/tests/acceptance/features/cliCommands/uploadSessions.feature +++ b/tests/acceptance/features/cliCommands/uploadSessions.feature @@ -21,7 +21,7 @@ Feature: List upload sessions via CLI command And the CLI response should not contain these entries: | file0.txt | - + @antivirus Scenario: list all upload sessions that are currently in postprocessing Given the following configs have been set: | config | value | @@ -39,7 +39,7 @@ Feature: List upload sessions via CLI command And the CLI response should not contain these entries: | virusFile.txt | - + @antivirus Scenario: list all upload sessions that are infected by virus Given the following configs have been set: | config | value | @@ -109,7 +109,7 @@ Feature: List upload sessions via CLI command And the CLI response should not contain these entries: | file2.txt | - + @antivirus Scenario: clean all upload sessions that are not in post-processing Given the following configs have been set: | config | value | @@ -126,7 +126,7 @@ Feature: List upload sessions via CLI command And the CLI response should not contain these entries: | file1.txt | - + @antivirus Scenario: clean upload sessions that are not in post-processing and is not virus infected Given the following configs have been set: | config | value | diff --git a/tests/acceptance/scripts/generate-virus-files.sh b/tests/acceptance/scripts/generate-virus-files.sh deleted file mode 100755 index 1b53495c0c..0000000000 --- a/tests/acceptance/scripts/generate-virus-files.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# tests/acceptance/scripts/generate-virus-files.sh - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -TARGET_DIR="$SCRIPT_DIR/../filesForUpload/filesWithVirus" - -echo "Generating EICAR test files..." - -mkdir -p "$TARGET_DIR" - -cd "$TARGET_DIR" - -echo "Downloading eicar.com..." -curl -s -o eicar.com https://secure.eicar.org/eicar.com - -echo "Downloading eicar_com.zip..." -curl -s -o eicar_com.zip https://secure.eicar.org/eicar_com.zip \ No newline at end of file diff --git a/tests/acceptance/scripts/run.sh b/tests/acceptance/scripts/run.sh index 408a4f3025..7eff837a75 100755 --- a/tests/acceptance/scripts/run.sh +++ b/tests/acceptance/scripts/run.sh @@ -547,7 +547,6 @@ fi export IPV4_URL export IPV6_URL -export FILES_FOR_UPLOAD="${SCRIPT_PATH}/filesForUpload/" TEST_LOG_FILE=$(mktemp) SCENARIOS_THAT_PASSED=0