mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-27 10:34:42 -05:00
Merge branch 'origin/main' into 'next-release/main'
This commit is contained in:
commit
3d677fa52b
9 files changed
+48
-44
No files matched your search
+9
-9
@@ -9,6 +9,7 @@ docker_repo_slug = "opencloudeu/opencloud"
|
||||
# images
|
||||
ALPINE_GIT = "alpine/git:latest"
|
||||
APACHE_TIKA = "apache/tika:4.2.1-SNAPSHOT"
|
||||
AXLLENT_MAILPIT = "axllent/mailpit:v1.32.0"
|
||||
CHKO_DOCKER_PUSHRM = "chko/docker-pushrm:1"
|
||||
CODACY_COVERAGE_REPORTER = "codacy/codacy-coverage-reporter:14.1.3"
|
||||
COLLABORA_CODE = "collabora/code:24.04.5.1.1"
|
||||
@@ -17,7 +18,6 @@ OPEN_SEARCH = "opensearchproject/opensearch:2"
|
||||
# imagor for the thumbnail parity suite, keep equal to imagortest.Variants
|
||||
IMAGOR = "shumc/imagor:1.9.11"
|
||||
IMAGOR_MAGICK = "ghcr.io/cshum/imagor-magick:1.9.11"
|
||||
INBUCKET_INBUCKET = "inbucket/inbucket"
|
||||
MINIO_MC = "quay.io/opencloudeu/minio-mc-ci:1.0"
|
||||
OC_CI_ALPINE = "owncloudci/alpine:latest"
|
||||
OC_CI_BAZEL_BUILDIFIER = "quay.io/opencloudeu/bazel-buildifier-ci:latest"
|
||||
@@ -164,12 +164,12 @@ config = {
|
||||
"emailNeeded": True,
|
||||
"extraTestEnvironment": {
|
||||
"EMAIL_HOST": "email",
|
||||
"EMAIL_PORT": "9000",
|
||||
"EMAIL_PORT": "8025",
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"OC_ADD_RUN_SERVICES": "notifications",
|
||||
"NOTIFICATIONS_SMTP_HOST": "email",
|
||||
"NOTIFICATIONS_SMTP_PORT": "2500",
|
||||
"NOTIFICATIONS_SMTP_PORT": "1025",
|
||||
"NOTIFICATIONS_SMTP_INSECURE": True,
|
||||
"NOTIFICATIONS_SMTP_SENDER": "ownCloud <noreply@example.com>",
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
@@ -261,12 +261,12 @@ config = {
|
||||
"emailNeeded": True,
|
||||
"extraTestEnvironment": {
|
||||
"EMAIL_HOST": "email",
|
||||
"EMAIL_PORT": "9000",
|
||||
"EMAIL_PORT": "8025",
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"OC_ADD_RUN_SERVICES": "notifications",
|
||||
"NOTIFICATIONS_SMTP_HOST": "email",
|
||||
"NOTIFICATIONS_SMTP_PORT": "2500",
|
||||
"NOTIFICATIONS_SMTP_PORT": "1025",
|
||||
"NOTIFICATIONS_SMTP_INSECURE": True,
|
||||
"NOTIFICATIONS_SMTP_SENDER": "ownCloud <noreply@example.com>",
|
||||
"NOTIFICATIONS_DEBUG_ADDR": "0.0.0.0:9174",
|
||||
@@ -306,7 +306,7 @@ config = {
|
||||
"emailNeeded": True,
|
||||
"extraTestEnvironment": {
|
||||
"EMAIL_HOST": "email",
|
||||
"EMAIL_PORT": "9000",
|
||||
"EMAIL_PORT": "8025",
|
||||
},
|
||||
"extraServerEnvironment": {
|
||||
"OC_ADD_RUN_SERVICES": "ocm,notifications",
|
||||
@@ -317,7 +317,7 @@ config = {
|
||||
"OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE": "%s" % dirs["ocmProviders"],
|
||||
# mail notifications
|
||||
"NOTIFICATIONS_SMTP_HOST": "email",
|
||||
"NOTIFICATIONS_SMTP_PORT": "2500",
|
||||
"NOTIFICATIONS_SMTP_PORT": "1025",
|
||||
"NOTIFICATIONS_SMTP_INSECURE": True,
|
||||
"NOTIFICATIONS_SMTP_SENDER": "ownCloud <noreply@example.com>",
|
||||
},
|
||||
@@ -3255,7 +3255,7 @@ def restoreBrowsersCache():
|
||||
def emailService():
|
||||
return [{
|
||||
"name": "email",
|
||||
"image": INBUCKET_INBUCKET,
|
||||
"image": AXLLENT_MAILPIT,
|
||||
}]
|
||||
|
||||
def waitForEmailService():
|
||||
@@ -3263,7 +3263,7 @@ def waitForEmailService():
|
||||
"name": "wait-for-email",
|
||||
"image": OC_CI_WAIT_FOR,
|
||||
"commands": [
|
||||
"wait-for -host email -port 9000 -timeout 600",
|
||||
"wait-for -host email -port 8025 -timeout 600",
|
||||
],
|
||||
}]
|
||||
|
||||
|
||||
+6
-6
@@ -317,14 +317,14 @@ While writing tests for a new OpenCloud ENV configuration, please make sure to f
|
||||
|
||||
### Running Test Suite With Email Service (@email)
|
||||
|
||||
Test suites that are tagged with `@email` require an email service. We use inbucket as the email service in our tests.
|
||||
Test suites that are tagged with `@email` require an email service. We use [mailpit](https://mailpit.axllent.org/) as the email service in our tests: it catches the emails that OpenCloud sends via SMTP (port 1025), and the tests read them through its API (port 8025). Its web UI at http://localhost:8025 shows the caught emails.
|
||||
|
||||
#### Setup Inbucket
|
||||
#### Setup Mailpit
|
||||
|
||||
Run the following command to setup inbucket
|
||||
Run the following command to setup mailpit
|
||||
|
||||
```bash
|
||||
docker run -d -p9000:9000 -p2500:2500 --name inbucket inbucket/inbucket
|
||||
docker run -d -p 127.0.0.1:8025:8025 -p 127.0.0.1:1025:1025 --name mailpit axllent/mailpit:v1.32.0
|
||||
```
|
||||
|
||||
#### Run OpenCloud
|
||||
@@ -340,7 +340,7 @@ opencloud/bin/opencloud init --insecure true
|
||||
PROXY_ENABLE_BASIC_AUTH=true \
|
||||
OC_ADD_RUN_SERVICES=notifications \
|
||||
NOTIFICATIONS_SMTP_HOST=localhost \
|
||||
NOTIFICATIONS_SMTP_PORT=2500 \
|
||||
NOTIFICATIONS_SMTP_PORT=1025 \
|
||||
NOTIFICATIONS_SMTP_INSECURE=true \
|
||||
NOTIFICATIONS_SMTP_SENDER="OpenCloud <noreply@example.com>" \
|
||||
opencloud/bin/opencloud server
|
||||
@@ -353,7 +353,7 @@ Run the acceptance test with the following command:
|
||||
```bash
|
||||
TEST_SERVER_URL="https://localhost:9200" \
|
||||
EMAIL_HOST="localhost" \
|
||||
EMAIL_PORT=9000 \
|
||||
EMAIL_PORT=8025 \
|
||||
BEHAT_FEATURE="tests/acceptance/features/apiNotification/emailNotification.feature" \
|
||||
make test-acceptance-api
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ class EmailHelper {
|
||||
$localEmailHost = self::getLocalEmailHost();
|
||||
$emailPort = \getenv('EMAIL_PORT');
|
||||
if ($emailPort === false) {
|
||||
$emailPort = "9000";
|
||||
$emailPort = "8025";
|
||||
}
|
||||
return "http://$localEmailHost:$emailPort";
|
||||
}
|
||||
@@ -81,8 +81,8 @@ class EmailHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns general response information about the provided mailbox
|
||||
* A mailbox is created automatically in InBucket for every unique email sender|receiver
|
||||
* Returns the emails sent to the provided mailbox (the local part of the
|
||||
* address), the oldest first
|
||||
*
|
||||
* @param string $mailBox
|
||||
* @param string|null $xRequestId
|
||||
@@ -92,19 +92,28 @@ class EmailHelper {
|
||||
*/
|
||||
public static function getMailBoxInformation(string $mailBox, ?string $xRequestId = null): array {
|
||||
$response = HttpRequestHelper::get(
|
||||
self::getLocalEmailUrl() . "/api/v1/mailbox/" . $mailBox,
|
||||
self::getLocalEmailUrl() . "/api/v1/search?query=" . \urlencode("to:$mailBox"),
|
||||
$xRequestId,
|
||||
null,
|
||||
null,
|
||||
['Content-Type' => 'application/json']
|
||||
);
|
||||
return \json_decode($response->getBody()->getContents());
|
||||
$emails = \json_decode($response->getBody()->getContents())->messages;
|
||||
// mailpit also finds parts of addresses (to:alice finds malice@...)
|
||||
$emails = \array_filter(
|
||||
$emails,
|
||||
fn ($email) => \in_array(
|
||||
\strtolower($mailBox),
|
||||
\array_map(fn ($to) => \strtolower(self::getMailBoxFromEmail($to->Address)), $email->To)
|
||||
)
|
||||
);
|
||||
// mailpit lists the newest first
|
||||
return \array_reverse(\array_values($emails));
|
||||
}
|
||||
|
||||
/**
|
||||
* returns body content of a specific email (mailBox) with email ID (mailbox Id)
|
||||
* returns a specific email by its ID
|
||||
*
|
||||
* @param string $mailBox
|
||||
* @param string $mailboxId
|
||||
* @param string|null $xRequestId
|
||||
*
|
||||
@@ -112,12 +121,11 @@ class EmailHelper {
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function getBodyOfAnEmailById(
|
||||
string $mailBox,
|
||||
string $mailboxId,
|
||||
?string $xRequestId = null
|
||||
): object {
|
||||
$response = HttpRequestHelper::get(
|
||||
self::getLocalEmailUrl() . "/api/v1/mailbox/" . $mailBox . "/" . $mailboxId,
|
||||
self::getLocalEmailUrl() . "/api/v1/message/" . $mailboxId,
|
||||
$xRequestId,
|
||||
null,
|
||||
null,
|
||||
@@ -143,14 +151,10 @@ class EmailHelper {
|
||||
$mailBox = self::getMailBoxFromEmail($emailAddress);
|
||||
$emails = self::getMailboxInformation($mailBox, $xRequestId);
|
||||
if (!empty($emails)) {
|
||||
$emailId = \array_pop($emails)->id;
|
||||
$response = self::getBodyOfAnEmailById($mailBox, $emailId, $xRequestId);
|
||||
$body = \str_replace(
|
||||
"\r\n",
|
||||
"\n",
|
||||
\quoted_printable_decode($response->body->text . "\n" . $response->body->html)
|
||||
);
|
||||
return $body;
|
||||
$emailId = \array_pop($emails)->ID;
|
||||
$response = self::getBodyOfAnEmailById($emailId, $xRequestId);
|
||||
// mailpit returns the body decoded already
|
||||
return \str_replace("\r\n", "\n", $response->Text . "\n" . $response->HTML);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -171,7 +175,7 @@ class EmailHelper {
|
||||
string $xRequestId,
|
||||
): ResponseInterface {
|
||||
return HttpRequestHelper::delete(
|
||||
$url . "/api/v1/mailbox/" . $mailBox,
|
||||
$url . "/api/v1/search?query=" . \urlencode("to:$mailBox"),
|
||||
$xRequestId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class GuestLinkContext implements Context {
|
||||
$this->featureContext->getStepLineRef(),
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo __METHOD__ . " could not delete emails of '$mailBox', is inbucket set up?\n" . $e->getMessage();
|
||||
echo __METHOD__ . " could not delete emails of '$mailBox', is mailpit set up?\n" . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ class NotificationContext implements Context {
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo __METHOD__ .
|
||||
" could not delete inbucket messages, is inbucket set up?\n" .
|
||||
" could not delete emails, is mailpit set up?\n" .
|
||||
$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
USE_BEARER_TOKEN: ${USE_BEARER_TOKEN:-false}
|
||||
# email
|
||||
EMAIL_HOST: email
|
||||
EMAIL_PORT: 9000
|
||||
EMAIL_PORT: 8025
|
||||
env_file:
|
||||
- ../../../../.woodpecker.env
|
||||
extra_hosts:
|
||||
|
||||
@@ -3,8 +3,8 @@ services:
|
||||
image: dadarek/wait-for-dependencies
|
||||
depends_on:
|
||||
- email
|
||||
command: email:9000
|
||||
command: email:8025
|
||||
email:
|
||||
image: inbucket/inbucket
|
||||
image: axllent/mailpit:v1.32.0
|
||||
ports:
|
||||
- '9000:9000'
|
||||
- '8025:8025'
|
||||
@@ -29,7 +29,7 @@ services:
|
||||
STORAGE_USERS_DECOMPOSEDS3_BUCKET: test
|
||||
# email
|
||||
NOTIFICATIONS_SMTP_HOST: email
|
||||
NOTIFICATIONS_SMTP_PORT: 2500
|
||||
NOTIFICATIONS_SMTP_PORT: 1025
|
||||
NOTIFICATIONS_SMTP_INSECURE: "true"
|
||||
NOTIFICATIONS_SMTP_SENDER: "OpenCloud <noreply@example.com>"
|
||||
NOTIFICATIONS_DEBUG_ADDR: 0.0.0.0:9174
|
||||
|
||||
@@ -619,15 +619,15 @@ then
|
||||
BEHAT_FILTER_TAGS="${BEHAT_FILTER_TAGS#&&}"
|
||||
fi
|
||||
|
||||
# EMAIL_HOST defines where the system-under-test can find the email server (inbucket)
|
||||
# EMAIL_HOST defines where the system-under-test can find the email server (mailpit)
|
||||
# for sending email.
|
||||
if [ -z "${EMAIL_HOST}" ]
|
||||
then
|
||||
EMAIL_HOST="127.0.0.1"
|
||||
fi
|
||||
|
||||
# LOCAL_INBUCKET_HOST defines where this test script can find the Inbucket server
|
||||
# for sending email. When testing a remote system, the Inbucket server somewhere
|
||||
# LOCAL_EMAIL_HOST defines where this test script can find the mailpit server
|
||||
# for reading email. When testing a remote system, the mailpit server somewhere
|
||||
# "in the middle" might have a different host name from the point of view of
|
||||
# the test script.
|
||||
if [ -z "${LOCAL_EMAIL_HOST}" ]
|
||||
@@ -637,7 +637,7 @@ fi
|
||||
|
||||
if [ -z "${EMAIL_SMTP_PORT}" ]
|
||||
then
|
||||
EMAIL_SMTP_PORT="2500"
|
||||
EMAIL_SMTP_PORT="1025"
|
||||
fi
|
||||
|
||||
# If the caller did not mention specific tags, skip the skipped tests by default
|
||||
|
||||
Reference in new issue
Block a user