Skip to content

Commit 7753e2a

Browse files
committed
test: run Core-API-8 test suite on k8s
1 parent 283c5d4 commit 7753e2a

File tree

12 files changed

+48
-28
lines changed

12 files changed

+48
-28
lines changed

.drone.star

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ config = {
377377
"coreApiWebdavUploadTUS",
378378
],
379379
"skip": False,
380+
"k8s": True,
380381
},
381382
},
382383
"e2eTests": {
@@ -2749,7 +2750,7 @@ def build():
27492750
"name": "build",
27502751
"image": OC_CI_GOLANG,
27512752
"commands": [
2752-
"retry -t 3 'make -C ocis build'",
2753+
"retry -t 3 'make -C ocis build ENABLE_VIPS=true'",
27532754
],
27542755
"environment": DRONE_HTTP_PROXY_ENV,
27552756
"volumes": [stepVolumeGo],
@@ -2762,7 +2763,7 @@ def buildDebug():
27622763
"name": "build debug binary",
27632764
"image": OC_CI_GOLANG,
27642765
"commands": [
2765-
"retry -t 3 'make -C ocis build-debug'",
2766+
"retry -t 3 'make -C ocis build-debug ENABLE_VIPS=true'",
27662767
],
27672768
"environment": DRONE_HTTP_PROXY_ENV,
27682769
"volumes": [stepVolumeGo],
@@ -3843,6 +3844,10 @@ def prepareOcisDeployment():
38433844
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/frontend/deployment.yaml",
38443845
"sed -i 's|mountPath: /etc/ocis$|mountPath: /etc/ocis/config/drone|' ./charts/ocis/templates/frontend/deployment.yaml",
38453846
"sed -i 's|name: sharing-banned-passwords-{{ .appName }}|name: sharing-banned-passwords|' ./charts/ocis/templates/frontend/deployment.yaml",
3847+
# Patch thumbnails deployment to mount Unicode fonts (ConfigMaps created in k3sCluster)
3848+
"sed -i '/- name: THUMBNAILS_TRANSFER_TOKEN/i\\\\ - name: THUMBNAILS_TXT_FONTMAP_FILE\\\n value: /etc/ocis/fontsMap.json\\\n' ./charts/ocis/templates/thumbnails/deployment.yaml",
3849+
"sed -i '/volumeMounts:/a\\\\ - name: ocis-fonts-ttf\\\n mountPath: /etc/ocis/fonts\\\n - name: ocis-fonts-map\\\n mountPath: /etc/ocis/fontsMap.json\\\n subPath: fontsMap.json' ./charts/ocis/templates/thumbnails/deployment.yaml",
3850+
"sed -i '/volumes:/a\\\\ - name: ocis-fonts-ttf\\\n configMap:\\\n name: ocis-fonts-ttf\\\n - name: ocis-fonts-map\\\n configMap:\\\n name: ocis-fonts-map' ./charts/ocis/templates/thumbnails/deployment.yaml",
38463851
]
38473852

38483853
return [{
@@ -3863,6 +3868,10 @@ def setupOcisConfigMaps():
38633868
# Create namespace for oCIS deployment
38643869
"kubectl create namespace ocis || true",
38653870
"kubectl create configmap -n ocis sharing-banned-passwords --from-file=banned-password-list.txt=%s/tests/config/drone/banned-password-list.txt" % dirs["base"],
3871+
# Setup Unicode font support for thumbnails - create ConfigMaps
3872+
"echo '{\"defaultFont\": \"/etc/ocis/fonts/NotoSans.ttf\"}' > %s/fontsMap.json" % dirs["base"],
3873+
"kubectl create configmap -n ocis ocis-fonts-ttf --from-file=%s/tests/config/drone/NotoSans.ttf" % dirs["base"],
3874+
"kubectl create configmap -n ocis ocis-fonts-map --from-file=%s/fontsMap.json" % dirs["base"],
38663875
]
38673876

38683877
return [{

tests/acceptance/bootstrap/WebDav.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4039,8 +4039,19 @@ public function checkImageDimensions(string $width, string $height, ?ResponseInt
40394039
$responseBodyContent = $response->getBody()->getContents();
40404040
$size = \getimagesizefromstring($responseBodyContent);
40414041
Assert::assertNotFalse($size, "could not get size of image");
4042-
Assert::assertEquals($width, $size[0], "width not as expected");
4043-
Assert::assertEquals($height, $size[1], "height not as expected");
4042+
// allow multiple acceptable expected dimensions, comma-separated
4043+
$checkDimension = static function (string $expected, int $actual, string $message): void {
4044+
$expectedParts = array_map('trim', explode(',', $expected));
4045+
$expectedInts = array_map('intval', $expectedParts);
4046+
if (\count($expectedInts) > 1) {
4047+
Assert::assertContainsEquals($actual, $expectedInts, $message);
4048+
} else {
4049+
Assert::assertEquals($expectedInts[0], $actual, $message);
4050+
}
4051+
};
4052+
4053+
$checkDimension($width, $size[0], "width not as expected");
4054+
$checkDimension($height, $size[1], "height not as expected");
40444055
}
40454056

40464057
/**

tests/acceptance/features/coreApiWebdavPreviews/previews.feature

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ Feature: previews of files downloaded through the webdav API
389389
@issue-10589 @env-config
390390
Scenario Outline: try to download a file preview when the maximum thumbnail input value in the environment is set to a small value
391391
Given the following configs have been set:
392-
| config | value |
393-
| THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB |
394-
| THUMBNAILS_MAX_INPUT_WIDTH | 200 |
395-
| THUMBNAILS_MAX_INPUT_HEIGHT | 200 |
392+
| service | config | value |
393+
| thumbnails | THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB |
394+
| thumbnails | THUMBNAILS_MAX_INPUT_WIDTH | 200 |
395+
| thumbnails | THUMBNAILS_MAX_INPUT_HEIGHT | 200 |
396396
And using <dav-path-version> DAV path
397397
And user "Alice" has uploaded file "filesForUpload/lorem-big.txt" to "/lorem-big.txt"
398398
When user "Alice" downloads the preview of "/lorem-big.txt" with width "32" and height "32" and processor thumbnail using the WebDAV API
@@ -407,10 +407,10 @@ Feature: previews of files downloaded through the webdav API
407407
@issue-10589 @env-config
408408
Scenario Outline: download a file preview when the maximum thumbnail input value in the environment is set to a valid value
409409
Given the following configs have been set:
410-
| config | value |
411-
| THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB |
412-
| THUMBNAILS_MAX_INPUT_WIDTH | 700 |
413-
| THUMBNAILS_MAX_INPUT_HEIGHT | 700 |
410+
| service | config | value |
411+
| thumbnails | THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 1KB |
412+
| thumbnails | THUMBNAILS_MAX_INPUT_WIDTH | 700 |
413+
| thumbnails | THUMBNAILS_MAX_INPUT_HEIGHT | 700 |
414414
And using <dav-path-version> DAV path
415415
And user "Alice" has uploaded file with content "hello world" to "test.txt"
416416
When user "Alice" downloads the preview of "/test.txt" with width "32" and height "32" and processor thumbnail using the WebDAV API
@@ -424,10 +424,10 @@ Feature: previews of files downloaded through the webdav API
424424
@issue-10589 @env-config
425425
Scenario Outline: download an image preview when the maximum thumbnail input value in the environment is set to a valid value
426426
Given the following configs have been set:
427-
| config | value |
428-
| THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 36KB |
429-
| THUMBNAILS_MAX_INPUT_WIDTH | 1250 |
430-
| THUMBNAILS_MAX_INPUT_HEIGHT | 650 |
427+
| service | config | value |
428+
| thumbnails | THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE | 36KB |
429+
| thumbnails | THUMBNAILS_MAX_INPUT_WIDTH | 1250 |
430+
| thumbnails | THUMBNAILS_MAX_INPUT_HEIGHT | 650 |
431431
And using <dav-path-version> DAV path
432432
And user "Alice" has uploaded file "filesForUpload/testavatar.png" to "/testimage.png"
433433
When user "Alice" downloads the preview of "/testimage.png" with width "32" and height "32" and processor thumbnail using the WebDAV API

tests/acceptance/features/coreApiWebdavPreviews/previewsAutoAdustedSizing.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ Feature: sizing of previews of files downloaded through the webdav API
2121
| request-width | request-height | return-width | return-height | dav-path-version |
2222
| 1 | 1 | 16 | 16 | old |
2323
| 32 | 32 | 32 | 32 | old |
24-
| 1024 | 1024 | 640 | 480 | old |
24+
| 1024 | 1024 | 640 | 480,640 | old |
2525
| 1 | 1024 | 16 | 16 | old |
26-
| 1024 | 1 | 640 | 480 | old |
26+
| 1024 | 1 | 640 | 480,640 | old |
2727
| 1 | 1 | 16 | 16 | new |
2828
| 32 | 32 | 32 | 32 | new |
29-
| 1024 | 1024 | 640 | 480 | new |
29+
| 1024 | 1024 | 640 | 480,640 | new |
3030
| 1 | 1024 | 16 | 16 | new |
31-
| 1024 | 1 | 640 | 480 | new |
31+
| 1024 | 1 | 640 | 480,640 | new |
3232
| 1 | 1 | 16 | 16 | spaces |
3333
| 32 | 32 | 32 | 32 | spaces |
34-
| 1024 | 1024 | 640 | 480 | spaces |
34+
| 1024 | 1024 | 640 | 480,640 | spaces |
3535
| 1 | 1024 | 16 | 16 | spaces |
36-
| 1024 | 1 | 640 | 480 | spaces |
36+
| 1024 | 1 | 640 | 480,640 | spaces |

tests/acceptance/features/coreApiWebdavUploadTUS/creationWithUploadExtension.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Feature: tests of the creation extension see https://tus.io/protocols/resumable-
1818
| Tus-Extension | creation-with-upload |
1919
Then the HTTP status code should be "201"
2020
And the following headers should match these regular expressions
21-
| Tus-Resumable | /1\.0\.0/ |
22-
| Location | /http[s]?:\/\/.*:\d+\/data\/.*/ |
23-
| Upload-Offset | /\d+/ |
21+
| Tus-Resumable | /1\.0\.0/ |
22+
| Location | /http[s]?:\/\/.*(?::\d+)?\/data\/.*/ |
23+
| Upload-Offset | /\d+/ |
2424
And the content of file "/test.txt" for user "Alice" should be "uploaded content"
2525
Examples:
2626
| dav-path-version |

tests/acceptance/features/coreApiWebdavUploadTUS/lowLevelCreationExtension.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Feature: low level tests of the creation extension see https://tus.io/protocols/
1616
| Tus-Resumable | 1.0.0 |
1717
Then the HTTP status code should be "201"
1818
And the following headers should match these regular expressions
19-
| Tus-Resumable | /1\.0\.0/ |
20-
| Location | /http[s]?:\/\/.*:\d+\/data\/.*/ |
19+
| Tus-Resumable | /1\.0\.0/ |
20+
| Location | /http[s]?:\/\/.*(?::\d+)?\/data\/.*/ |
2121
Examples:
2222
| dav-path-version |
2323
| old |

tests/acceptance/features/coreApiWebdavUploadTUS/lowLevelUpload.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Feature: low level tests for upload of chunks
5151
When user "Alice" sends a chunk to the last created TUS Location with offset "0" and data "123" using the WebDAV API
5252
And user "Alice" sends a chunk to the last created TUS Location with offset "3" and data "4567890" using the WebDAV API
5353
And user "Alice" sends a chunk to the last created TUS Location with offset "3" and data "0000000" using the WebDAV API
54-
Then the HTTP status code should be "404"
54+
Then the HTTP status code should be "404" or "409"
5555
And the content of file "/file.txt" for user "Alice" should be "1234567890"
5656
Examples:
5757
| dav-path-version |

tests/acceptance/fixtures/fill.png

155 Bytes
Loading

tests/acceptance/fixtures/fit.png

172 Bytes
Loading
155 Bytes
Loading

0 commit comments

Comments
 (0)