From 2d632b5e5bcfbd49bf3355c51be8269eff938242 Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Fri, 17 Jan 2025 16:43:09 +0100 Subject: [PATCH 1/2] php-setup-and-run-all-tests --- .../bootstrap/WebDavPropertiesContext.php | 4 +- tests/acceptance/run_all_tests.sh | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100755 tests/acceptance/run_all_tests.sh diff --git a/tests/acceptance/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/bootstrap/WebDavPropertiesContext.php index ac369e364..5927de7e2 100644 --- a/tests/acceptance/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/bootstrap/WebDavPropertiesContext.php @@ -315,7 +315,7 @@ class WebDavPropertiesContext implements Context { string $propertyName, string $path, string $propertyValue, - string $namespace = null, + ?string $namespace = null, ): ResponseInterface { $user = $this->featureContext->getActualUsername($user); return WebDavHelper::proppatch( @@ -648,7 +648,7 @@ class WebDavPropertiesContext implements Context { public function checkResponseContainsProperty( ResponseInterface $response, string $key, - string $namespaceString = null + ?string $namespaceString = null ): SimpleXMLElement { $xmlPart = HttpRequestHelper::getResponseXml($response, __METHOD__); ; diff --git a/tests/acceptance/run_all_tests.sh b/tests/acceptance/run_all_tests.sh new file mode 100755 index 000000000..423ec65cd --- /dev/null +++ b/tests/acceptance/run_all_tests.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# LOCAL TEST WITHOUT EXTRA ENVS +TEST_SERVER_URL="https://localhost:9200" +EXPECTED_FAILURES_FILE="tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md" + +# List of suites to run +SUITES=( + "apiArchiver" + "apiContract" + "apiCors" + "apiAsyncUpload" + "apiDownloads" + "apiDepthInfinity" + "apiLocks" + "apiActivities" + "apiSettings" + "apiGraph" + "apiServiceAvailability" + "apiGraphUserGroup" + "apiSpaces" + "apiSpacesShares" + "apiSpacesDavOperation" + "apiSearch1" + "apiSearch2" + "apiReshare" + "apiSharingNg1" + "apiSharingNg2" + "apiSharingNgShareInvitation" + "apiSharingNgLinkSharePermission" + "apiSharingNgLinkShareRoot" + "apiAccountsHashDifficulty" +) + +# Create log directory +LOG_DIR="./suite-logs" +mkdir -p "$LOG_DIR" + +SUCCESS_COUNT=0 +FAILURE_COUNT=0 + +for SUITE in "${SUITES[@]}"; do + echo "==============================================" + echo "Running suite: $SUITE" + echo "==============================================" + + LOG_FILE="$LOG_DIR/${SUITE}.log" + + # Run suite + make test-acceptance-api TEST_SERVER_URL=$TEST_SERVER_URL EXPECTED_FAILURES_FILE=$EXPECTED_FAILURES_FILE BEHAT_SUITE=$SUITE > "$LOG_FILE" 2>&1 + + # Check if suite was successful + if [ $? -eq 0 ]; then + echo "✅ Suite $SUITE completed successfully." + ((SUCCESS_COUNT++)) + else + echo "❌ Suite $SUITE failed. Check log: $LOG_FILE" + ((FAILURE_COUNT++)) + fi +done + +# Report summary +echo "==============================================" +echo "Test Summary:" +echo "✅ Successful suites: $SUCCESS_COUNT" +echo "❌ Failed suites: $FAILURE_COUNT" +echo "Logs saved in: $LOG_DIR" +echo "==============================================" From 7a28e6f49daa9fabea462f23620777dbbd23d72d Mon Sep 17 00:00:00 2001 From: Viktor Scharf Date: Mon, 20 Jan 2025 10:16:59 +0100 Subject: [PATCH 2/2] settins tests fix --- .gitignore | 1 + services/settings/README.md | 22 +++++++++---------- .../pkg/service/v0/servicedecorator.go | 2 +- .../settings/pkg/store/defaults/defaults.go | 12 +++++----- .../acceptance/TestHelpers/SharingHelper.php | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index e7fdc1c00..7e94f1498 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ vendor-php # API acceptance tests - auto-generated files .php-cs-fixer.cache +suite-logs # QA activity reports tests/qa-activity-report/reports/ diff --git a/services/settings/README.md b/services/settings/README.md index 9e6da1fe9..0e00a5eaf 100644 --- a/services/settings/README.md +++ b/services/settings/README.md @@ -15,18 +15,18 @@ As an example, user profile settings that can be changed in the Web UI must be p The settings service persists the settings data via the `storage-system` service. @@ -90,7 +90,7 @@ which is the source of the texts provided by the code. The default language can be defined via the `OC_DEFAULT_LANGUAGE` environment variable. If this variable is not defined, English will be used as default. The value has the ISO 639-1 format ("de", "en", etc.) and is limited by the list supported languages. This setting can be used to set the default language for notification and invitation emails. -Important developer note: the list of supported languages is at the moment not easy defineable, as it is the minimum intersection of languages shown in the WebUI and languages defined in the ocis code for the use of notifications and userlog. Even more, not all languages where there are translations available on transifex, are available in the WebUI respectively for ocis notifications, and the translation rate for existing languages is partially not that high. You will see therefore quite often English default strings though a supported language may exist and was selected. +Important developer note: the list of supported languages is at the moment not easy defineable, as it is the minimum intersection of languages shown in the WebUI and languages defined in the OpenCloud code for the use of notifications and userlog. Even more, not all languages where there are translations available on transifex, are available in the WebUI respectively for OpenCloud notifications, and the translation rate for existing languages is partially not that high. You will see therefore quite often English default strings though a supported language may exist and was selected. The `OC_DEFAULT_LANGUAGE` setting impacts the `notification` and `userlog` services and the WebUI. Note that translations must exist for all named components to be presented correctly. @@ -104,7 +104,7 @@ The `OC_DEFAULT_LANGUAGE` setting impacts the `notification` and `userlog` servi ## Custom Roles -It is possible to replace the default ocis roles (`admin`, `user`) with custom roles that contain custom permissions. One can set `SETTINGS_BUNDLES_PATH` to the path of a `json` file containing the new roles. +It is possible to replace the default OpenCloud roles (`admin`, `user`) with custom roles that contain custom permissions. One can set `SETTINGS_BUNDLES_PATH` to the path of a `json` file containing the new roles. Role Example: ```json @@ -113,7 +113,7 @@ Role Example: "id": "38071a68-456a-4553-846a-fa67bf5596cc", // ID of the role. Recommendation is to use a random uuidv4. But any unique string will do. "name": "user-light", // Internal name of the role. This is used by the system to identify the role. Any string will do here, but it should be unique among the other roles. "type": "TYPE_ROLE", // Always use `TYPE_ROLE` - "extension": "ocis-roles", // Always use `ocis-roles` + "extension": "opencloud-roles", // Always use `opencloud-roles` "displayName": "User Light", // DisplayName of the role used in webui "settings": [ ], // Permissions attached to the role. See Details below. @@ -128,7 +128,7 @@ To create custom roles: * Copy the role example to a `json` file. * Change `id`, `name`, and `displayName` to your liking. * Copy the desired permissions from the `user-all-permissions` example below to the `settings` array of the role. -* Set the `SETTINGS_BUNDLE_PATH` envvar to the path of the json file and start ocis +* Set the `SETTINGS_BUNDLE_PATH` envvar to the path of the json file and start OpenCloud Example File: ```json @@ -137,7 +137,7 @@ Example File: "id": "38071a68-456a-4553-846a-fa67bf5596cc", "name": "user-1-permission", "type": "TYPE_ROLE", - "extension": "ocis-roles", + "extension": "opencloud-roles", "displayName": "User with one permission only", "settings": [ { @@ -162,7 +162,7 @@ Example File: "id": "71881883-1768-46bd-a24d-a356a2afdf7f", "name": "user-all-permissions", "type": "TYPE_ROLE", - "extension": "ocis-roles", + "extension": "opencloud-roles", "displayName": "User with all available permissions", "settings": [ { diff --git a/services/settings/pkg/service/v0/servicedecorator.go b/services/settings/pkg/service/v0/servicedecorator.go index 2d44c07eb..d639b73c9 100644 --- a/services/settings/pkg/service/v0/servicedecorator.go +++ b/services/settings/pkg/service/v0/servicedecorator.go @@ -71,7 +71,7 @@ func (s *defaultLanguageDecorator) ListValues(ctx context.Context, req *settings func (s *defaultLanguageDecorator) withDefaultLanguageSetting(accountUUID string) *settingsmsg.ValueWithIdentifier { return &settingsmsg.ValueWithIdentifier{ Identifier: &settingsmsg.Identifier{ - Extension: "ocis-accounts", + Extension: "opencloud-accounts", Bundle: "profile", Setting: "language", }, diff --git a/services/settings/pkg/store/defaults/defaults.go b/services/settings/pkg/store/defaults/defaults.go index d5fa7466a..09b0bcb98 100644 --- a/services/settings/pkg/store/defaults/defaults.go +++ b/services/settings/pkg/store/defaults/defaults.go @@ -69,7 +69,7 @@ func ServiceAccountBundle() *settingsmsg.Bundle { Id: BundleUUIDServiceAccount, Name: "service-account", Type: settingsmsg.Bundle_TYPE_ROLE, - Extension: "ocis-roles", + Extension: "opencloud-roles", DisplayName: "Service Account", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, @@ -104,7 +104,7 @@ func generateBundleAdminRole() *settingsmsg.Bundle { Id: BundleUUIDRoleAdmin, Name: "admin", Type: settingsmsg.Bundle_TYPE_ROLE, - Extension: "ocis-roles", + Extension: "opencloud-roles", DisplayName: "Admin", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, @@ -150,7 +150,7 @@ func generateBundleSpaceAdminRole() *settingsmsg.Bundle { Id: BundleUUIDRoleSpaceAdmin, Name: "spaceadmin", Type: settingsmsg.Bundle_TYPE_ROLE, - Extension: "ocis-roles", + Extension: "opencloud-roles", DisplayName: "Space Admin", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, @@ -190,7 +190,7 @@ func generateBundleUserRole() *settingsmsg.Bundle { Id: BundleUUIDRoleUser, Name: "user", Type: settingsmsg.Bundle_TYPE_ROLE, - Extension: "ocis-roles", + Extension: "opencloud-roles", DisplayName: "User", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, @@ -224,7 +224,7 @@ func generateBundleUserLightRole() *settingsmsg.Bundle { Id: BundleUUIDRoleUserLight, Name: "user-light", Type: settingsmsg.Bundle_TYPE_ROLE, - Extension: "ocis-roles", + Extension: "opencloud-roles", DisplayName: "User Light", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, @@ -242,7 +242,7 @@ func generateBundleProfileRequest() *settingsmsg.Bundle { return &settingsmsg.Bundle{ Id: BundleUUIDProfile, Name: "profile", - Extension: "ocis-accounts", + Extension: "opencloud-accounts", Type: settingsmsg.Bundle_TYPE_DEFAULT, Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, diff --git a/tests/acceptance/TestHelpers/SharingHelper.php b/tests/acceptance/TestHelpers/SharingHelper.php index ec18ce699..40f6d71a4 100644 --- a/tests/acceptance/TestHelpers/SharingHelper.php +++ b/tests/acceptance/TestHelpers/SharingHelper.php @@ -101,7 +101,7 @@ class SharingHelper { string $xRequestId = '', ?string $shareWith = null, ?bool $publicUpload = false, - string $sharePassword = null, + ?string $sharePassword = null, $permissions = null, ?string $linkName = null, ?string $expireDate = null,