* test: run e2e app-provider with k8s setup Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: limit app-registry mimetypes Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: add host for onlyoffice Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: enable secure view Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> * test: add available unified roles Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com> --------- Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
Running API Tests in Kubernetes Cluster
Table of Contents
K8s Setup
Pre-requisites
-
Install the following tools:
-
Add these hosts to your
/etc/hostsfile:echo "127.0.0.1 ocis-server federation-ocis-server \ clamav collabora onlyoffice fakeoffice tika \ email" | sudo tee -a /etc/hosts
Deploy oCIS in K8s
-
Change directory to
<ocis-root>/tests/config/k8s:cd <ocis-root>/tests/config/k8s -
Create K8s Cluster
make create-cluster -
Prepare Charts
make prepare-chartsTip
To run the test suites that require extra services, use the following appropriate environment variables:
ENABLE_ANTIVIRUS=true: Antivirus test suitesENABLE_EMAIL=true: Notification test suitesENABLE_TIKA=true: Content search test suitesENABLE_WOPI=true: WOPI test suitesENABLE_OCM=true: OCM test suitesENABLE_AUTH_APP=true: auth-app test suitesENABLE_VAULT=true: Vault test suites (needsENABLE_TIKA=truetoo)
⚠️ When using the above environment variables, make sure you run the necessary external services and expose them to the cluster. Check the respective test running sections for more details.
Example:
ENABLE_EMAIL=true make prepare-charts -
Deploy oCIS
make deploy-ocis -
Check the ocis logs
make show-logs
Running API Tests
Build and run the ociswrapper to be able to run the API tests tagged with @env-config.
-
Change directory to the ocis root:
cd <ocis-root> -
Build the ociswrapper:
make -C tests/ociswrapper build -
Run the ociswrapper:
tests/ociswrapper/bin/ociswrapper serve \ --url https://ocis-server \ --admin-username admin \ --admin-password admin \ --skip-ocis-run \ -n ocis-server
Run General API tests
TEST_SERVER_URL=https://ocis-server \
K8S=true \
BEHAT_FEATURE=<test-suites-path>/apiDownloads/download.feature \
make test-acceptance-api
Run Notification API tests
-
Check if setup step 3 is done correctly. (
ENABLE_EMAIL=true) -
Start the email server
docker run -d -p 1025:1025 -p 8025:8025 axllent/mailpit:v1.22.3 -
Expose the email server to the cluster
bash tests/config/k8s/expose-external-svc.sh email:1025 -
Run the tests
TEST_SERVER_URL=https://ocis-server \ EMAIL_HOST=email \ EMAIL_PORT=8025 \ K8S=true \ BEHAT_FEATURE=<test-suites-path>/apiNotification/notification.feature \ make test-acceptance-api
Run Antivirus API tests
-
Check if setup step 3 is done correctly. (
ENABLE_ANTIVIRUS=true) -
Start the antivirus server
docker run -d -p 3310:3310 owncloudci/clamavd -
Expose the antivirus server to the cluster
bash tests/config/k8s/expose-external-svc.sh clamav:3310 -
Run the tests
TEST_SERVER_URL=https://ocis-server \ K8S=true \ BEHAT_FEATURE=<test-suites-path>/apiAntivirus/antivirus.feature \ make test-acceptance-api
Run Full Text Search API tests
-
Check if setup step 3 is done correctly. (
ENABLE_TIKA=true) -
Start the tika server
docker run -d -p 9998:9998 apache/tika:3.2.2.0-full -
Expose the tika server to the cluster
bash tests/config/k8s/expose-external-svc.sh tika:9998 -
Run the tests
TEST_SERVER_URL=https://ocis-server \ K8S=true \ BEHAT_FEATURE=<test-suites-path>/apiSearchContent/contentSearch.feature \ make test-acceptance-api
Run OCM tests
For running OCM test suite on k8s, we need to deploy a federation ocis server in a separate namespace on the same cluster, alongside the ocis server:
-
Check if setup step 3 is done correctly. (
ENABLE_OCM=true) -
Prepare Charts for federation oCIS
OCM=true make prepare-charts -
Deploy federation oCIS
OCM=true make deploy-ocis -
Run the tests
TEST_SERVER_URL=https://ocis-server \ TEST_SERVER_FED_URL=https://federation-ocis-server \ K8S=true \ BEHAT_FEATURE=<test-suites-path>/apiOcm/share.feature \ make test-acceptance-api
Run Vault tests
Vault mode requires Keycloak (as an external OIDC provider that can assert MFA/acr claims) backed by postgres, plus Tika for full text search:
-
Check if setup step 3 is done correctly. (
ENABLE_VAULT=true ENABLE_TIKA=true) -
Start postgres and Keycloak (self-signed cert,
CN=keycloak, importingtests/config/ci/ocis-mfa-ci-realm.dist.jsonwithhttps://localhost:9200replaced byhttps://ocis-server), and start tika:docker run -d --name postgres --network host \ -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=keycloak \ postgres:alpine3.18 docker run -d --name keycloak --network host \ -e OCIS_DOMAIN=https://ocis-server -e KC_HOSTNAME=keycloak -e KC_PORT=8443 \ -e KC_DB=postgres -e KC_DB_URL=jdbc:postgresql://localhost:5432/keycloak \ -e KC_DB_USERNAME=keycloak -e KC_DB_PASSWORD=keycloak \ -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \ -e KC_HTTPS_CERTIFICATE_FILE=/keycloak-certs/keycloakcrt.pem \ -e KC_HTTPS_CERTIFICATE_KEY_FILE=/keycloak-certs/keycloakkey.pem \ -v "$(pwd)/keycloak-certs:/keycloak-certs:ro" \ -v /tmp/ocis-realm.json:/opt/keycloak/data/import/ocis-mfa-ci-realm.dist.json:ro \ quay.io/keycloak/keycloak:26.5.6 \ start-dev --import-realm --health-enabled=true docker run -d -p 9998:9998 --name tika apache/tika:3.2.2.0-full -
Expose them to the cluster
bash tests/config/k8s/expose-external-svc.sh keycloak:8443 bash tests/config/k8s/expose-external-svc.sh tika:9998 -
Run the tests (Playwright is required for the
@javascript/web-UI-login scenarios; runvendor-php/bin/playwright-install --browsersonce first)TEST_SERVER_URL=https://ocis-server \ K8S=true \ KEYCLOAK=true \ KC_URL=https://keycloak:8443 \ BEHAT_FEATURE=<test-suites-path>/apiVault/vault.feature \ make test-acceptance-api
Cleanup the Setup
To delete the cluster and all the setup resources, run the following command:
make -C <ocis-root>/tests/config/k8s cleanup
This will delete the K8s cluster, ocis-charts, and ocis logs directory.