Skip to content
Open
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
27 changes: 12 additions & 15 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ jobs:
fail-fast: false
matrix:
suite:
- "coreApiAuth,coreApiCapabilities,coreApiFavorites,coreApiMain,coreApiVersions"
- "coreApiShareManagementBasicToShares,coreApiShareManagementToShares"
- "coreApiSharees,coreApiSharePublicLink2"
- "coreApiShareOperationsToShares1,coreApiShareOperationsToShares2,coreApiSharePublicLink1,coreApiShareCreateSpecialToShares1,coreApiShareCreateSpecialToShares2,coreApiShareUpdateToShares"
- "coreApiTrashbin,coreApiTrashbinRestore,coreApiWebdavEtagPropagation1,coreApiWebdavEtagPropagation2"
- "coreApiWebdavDelete,coreApiWebdavOperations,coreApiWebdavMove2"
- "coreApiWebdavProperties"
- "coreApiWebdavMove1,coreApiWebdavPreviews,coreApiWebdavUpload,coreApiWebdavUploadTUS"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
Expand Down Expand Up @@ -249,20 +253,13 @@ jobs:
EXPECTED_FAILURES_FILE=tests/acceptance/expected-failures-API-on-OCIS-storage.md
python3 tests/acceptance/run-github.py

- name: Upload test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ matrix.suite }}
path: tests/acceptance/output/

litmus:
name: litmus
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -274,8 +271,8 @@ jobs:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -287,8 +284,8 @@ jobs:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: true
Expand All @@ -300,8 +297,8 @@ jobs:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: true
Expand Down
40 changes: 38 additions & 2 deletions tests/acceptance/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -4063,10 +4063,46 @@ public function checkImageDimensions(string $width, string $height, ?ResponseInt
* @throws Exception
*/
public function theDownloadedPreviewContentShouldMatchWithFixturesPreviewContentFor(string $filename): void {
$expectedPreview = \file_get_contents(__DIR__ . "/../fixtures/" . $filename);
$fixturePath = __DIR__ . "/../fixtures/" . $filename;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before, the preview images ~32x17px were compared by exact bytes and apparently different compilations of libjpg (ubuntu, alpine, ...) produced slight differences at per pixel values.

Moving to comparison with threshold solved the issue. Added diagnostic logs to detect what fails and why. Also to see if we do per pixel php comparison on images with not too big resolution.

$fixtureImg = \imagecreatefromstring(\file_get_contents($fixturePath));
Assert::assertNotFalse($fixtureImg, "Could not decode fixture image $filename");

$this->getResponse()->getBody()->rewind();
$responseBodyContent = $this->getResponse()->getBody()->getContents();
Assert::assertEquals($expectedPreview, $responseBodyContent);
$responseImg = \imagecreatefromstring($responseBodyContent);
Assert::assertNotFalse($responseImg, "Downloaded preview is not a valid image");

$w = \imagesx($fixtureImg);
$h = \imagesy($fixtureImg);
Assert::assertEquals($w, \imagesx($responseImg), "Image width mismatch for fixture $filename");
Assert::assertEquals($h, \imagesy($responseImg), "Image height mismatch for fixture $filename");

$tolerance = 12; // per-channel tolerance for libvips version differences
$maxDiff = 0;
for ($x = 0; $x < $w; $x++) {
for ($y = 0; $y < $h; $y++) {
$fc = \imagecolorat($fixtureImg, $x, $y);
$rc = \imagecolorat($responseImg, $x, $y);
$maxDiff = \max(
$maxDiff,
\abs(($fc >> 16 & 0xFF) - ($rc >> 16 & 0xFF)),
\abs(($fc >> 8 & 0xFF) - ($rc >> 8 & 0xFF)),
\abs(($fc & 0xFF) - ($rc & 0xFF)),
);
}
}
$rw = \imagesx($responseImg);
$rh = \imagesy($responseImg);
echo " [preview-fixture] $filename: fixture={$w}x{$h} response={$rw}x{$rh} maxPixelDiff=$maxDiff\n";

Assert::assertLessThanOrEqual(
$tolerance,
$maxDiff,
"Preview pixel values differ by more than $tolerance from fixture $filename (max diff: $maxDiff)",
);

\imagedestroy($fixtureImg);
\imagedestroy($responseImg);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions tests/acceptance/expected-failures-without-remotephp.md
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So whole this file can be removed

#10339

Expected failures disappeared after upgrading curl to version that handles chunked upload body with no trailing bytes issues.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the errors are intentional and now different i.e. errors codes appear but are not cathced by assert a change in tests is needed.

Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
## Scenarios that are expected to fail when remote.php is not used

#### [Trying to create .. resource with /webdav root (old dav path) without remote.php returns html](https://github.com/owncloud/ocis/issues/10339)

- [coreApiWebdavProperties/createFileFolder.feature:176](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L176)
- [coreApiWebdavProperties/createFileFolder.feature:177](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L177)
- [coreApiWebdavProperties/createFileFolder.feature:196](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L196)
- [coreApiWebdavProperties/createFileFolder.feature:197](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L197)
- [coreApiWebdavUploadTUS/uploadFile.feature:177](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/uploadFile.feature#L177)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
2 changes: 2 additions & 0 deletions tests/acceptance/run-github.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ def main() -> int:

# generate IDP web assets (required for IDP service to start; matches drone ci-node-generate)
run(["make", "-C", str(repo_root / "services/idp"), "ci-node-generate"])
# download web UI assets (required for robots.txt and other static assets; no pnpm needed)
run(["make", "-C", str(repo_root / "services/web"), "ci-node-generate"])

# build (ENABLE_VIPS=true when libvips-dev is installed, matching drone)
build_env = {}
Expand Down