Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip
tools: composer
- name: Install PHP 8.4
run: |
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -qq
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
sudo update-alternatives --set php /usr/bin/php8.4
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- name: PHP code style
run: |
make vendor-bin-codestyle
Expand Down Expand Up @@ -113,7 +115,7 @@ jobs:
- apiActivities
# search
- apiSearch1
# - apiSearch2
- apiSearch2
- apiSearchContent # needs Tika
# sharing
- apiSharingNgShares
Expand Down Expand Up @@ -169,11 +171,15 @@ jobs:
}
'

- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip
tools: composer
- name: Install PHP 8.4
run: |
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -qq
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
sudo update-alternatives --set php /usr/bin/php8.4
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
php -v
composer --version

- name: Run ${{ matrix.suite }}
run: BEHAT_SUITES=${{ matrix.suite }} python3 tests/acceptance/run-github.py
Expand Down Expand Up @@ -201,11 +207,15 @@ jobs:
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@10.28.1 --activate

- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip
tools: composer
- name: Install PHP 8.4
run: |
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -qq
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
sudo update-alternatives --set php /usr/bin/php8.4
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
php -v
composer --version

- name: Run ${{ matrix.suite }}
run: BEHAT_SUITES="${{ matrix.suite }}" python3 tests/acceptance/run-github.py
Expand Down Expand Up @@ -262,11 +272,13 @@ jobs:
}
'

- uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
with:
php-version: "8.4"
extensions: curl, xml, mbstring, zip
tools: composer
- name: Install PHP 8.4
run: |
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update -qq
sudo apt-get install -y php8.4 php8.4-curl php8.4-xml php8.4-mbstring php8.4-zip php8.4-ldap php8.4-gd
sudo update-alternatives --set php /usr/bin/php8.4
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

- name: Run ${{ matrix.suite }}
run: >
Expand Down Expand Up @@ -306,10 +318,8 @@ jobs:
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- name: Setup pnpm
uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
version: "10.28.1"
- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@10.28.1 --activate
- name: Generate code
run: |
pnpm config set store-dir ./.pnpm-store
Expand All @@ -318,7 +328,7 @@ jobs:
CHROMEDRIVER_SKIP_DOWNLOAD: "true"

- name: Cache Playwright Chromium
uses: actions/cache@v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ hashFiles('.drone.env') }}
Expand Down Expand Up @@ -440,7 +450,7 @@ jobs:
run: python3 tests/acceptance/run-wopi.py --type cs3

all-acceptance-tests:
needs: [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
needs: [local-api-tests, cli-tests, wopi-cs3] # [local-api-tests, cli-tests, core-api-tests, litmus, cs3api, wopi-builtin, wopi-cs3, e2e-tests]
runs-on: ubuntu-latest
if: always()
steps:
Expand Down
50 changes: 42 additions & 8 deletions tests/acceptance/bootstrap/SearchContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,46 @@
class SearchContext implements Context {
private FeatureContext $featureContext;

/**
* Retry search until results are non-empty or timeout is reached.
* Indexing of newly uploaded files in ocis is async, so a single
* fixed sleep is not reliable — poll instead.
*
* @param string $user
* @param string $pattern
* @param string|null $limit
* @param string|null $scopeType
* @param string|null $scope
* @param string|null $spaceName
* @param TableNode|null $properties
*
* @return ResponseInterface
*/
private function searchWithRetry(
string $user,
string $pattern,
?string $limit = null,
?string $scopeType = null,
?string $scope = null,
?string $spaceName = null,
?TableNode $properties = null,
): ResponseInterface {
// Indexing is async — poll until results appear.
// Initial wait 3s, then retry every 2s, up to ~13s total.
$maxAttempts = STANDARD_RETRY_COUNT;
$response = null;
for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
\sleep($attempt === 0 ? 3 : 2);
$response = $this->searchFiles($user, $pattern, $limit, $scopeType, $scope, $spaceName, $properties);
$parsed = HttpRequestHelper::parseResponseAsXml($response);
if (\is_array($parsed) && isset($parsed["value"]) && !empty($parsed["value"])) {
return $response;
}
}
// return last response even if empty — let the assertion step produce the failure message
return $response;
}

/**
* @param string $user
* @param string $pattern
Expand Down Expand Up @@ -146,10 +186,7 @@ public function userSearchesUsingWebDavAPI(
?string $limit = null,
?TableNode $properties = null,
): void {
// NOTE: because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously
// short wait is necessary before searching
sleep(5);
$response = $this->searchFiles($user, $pattern, $limit, null, null, null, $properties);
$response = $this->searchWithRetry($user, $pattern, $limit, null, null, null, $properties);
$this->featureContext->setResponse($response);
}

Expand Down Expand Up @@ -269,10 +306,7 @@ public function userSearchesInsideFolderOrSpaceUsingWebDavAPI(
string $scope,
?string $spaceName = null,
): void {
// NOTE: since indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously,
// a short wait is necessary before searching
sleep(5);
$response = $this-> searchFiles($user, $pattern, null, $scopeType, $scope, $spaceName);
$response = $this->searchWithRetry($user, $pattern, null, $scopeType, $scope, $spaceName);
$this->featureContext->setResponse($response);
}
}
Loading