Files
ocis/tests/config/k8s/README.md
Prajwol AmatyaandPrajwol Amatya ddc34232f8 [tests-only][full-ci][k8s] test: run apiVault on k8s deployment (#12845)
* test: run apiVault on k8s deployment

Signed-off-by: Prajwol Amatya <prajwol.amatya@kiteworks.com>

* test: use oc_oAuth.user key to get token

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: debug storage-users-vault

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: add post test debug

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: log and retry until the deadline

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: expose proxy readyz

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: configure auth level name for proxy and frontend services

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: generate admin access token if expired

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: check ociswrapper logs

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: roll back to default auth level name

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: check if retry works

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: clean deduplicate environments

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: revert changes

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: regenerate access token on expiry

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: pre remove exiting envs

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: debug ociswrapper

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: delete only confirmed duplicate key

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: set keycloak url from setup.sh

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: use the already running postgres for keycloak's database

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

---------

Signed-off-by: Prajwol Amatya <prajwol.amatya@kiteworks.com>
Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
Co-authored-by: Prajwol Amatya <prajwol.amatya@kiteworks.com>
2026-09-10 16:49:07 +05:45

7.1 KiB

Running API Tests in Kubernetes Cluster

Table of Contents

K8s Setup

Pre-requisites

  1. Install the following tools:

  2. Add these hosts to your /etc/hosts file:

    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

  1. Change directory to <ocis-root>/tests/config/k8s:

    cd <ocis-root>/tests/config/k8s
    
  2. Create K8s Cluster

    make create-cluster
    
  3. Prepare Charts

    make prepare-charts
    

    Tip

    To run the test suites that require extra services, use the following appropriate environment variables:

    • ENABLE_ANTIVIRUS=true: Antivirus test suites
    • ENABLE_EMAIL=true: Notification test suites
    • ENABLE_TIKA=true: Content search test suites
    • ENABLE_WOPI=true: WOPI test suites
    • ENABLE_OCM=true: OCM test suites
    • ENABLE_AUTH_APP=true: auth-app test suites
    • ENABLE_VAULT=true: Vault test suites (needs ENABLE_TIKA=true too)

    ⚠️ 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
    
  4. Deploy oCIS

    make deploy-ocis
    
  5. 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.

  1. Change directory to the ocis root:

    cd <ocis-root>
    
  2. Build the ociswrapper:

    make -C tests/ociswrapper build
    
  3. 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

  1. Check if setup step 3 is done correctly. (ENABLE_EMAIL=true)

  2. Start the email server

    docker run -d -p 1025:1025 -p 8025:8025 axllent/mailpit:v1.22.3
    
  3. Expose the email server to the cluster

    bash tests/config/k8s/expose-external-svc.sh email:1025
    
  4. 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

  1. Check if setup step 3 is done correctly. (ENABLE_ANTIVIRUS=true)

  2. Start the antivirus server

    docker run -d -p 3310:3310 owncloudci/clamavd
    
  3. Expose the antivirus server to the cluster

    bash tests/config/k8s/expose-external-svc.sh clamav:3310
    
  4. 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

  1. Check if setup step 3 is done correctly. (ENABLE_TIKA=true)

  2. Start the tika server

    docker run -d -p 9998:9998 apache/tika:3.2.2.0-full
    
  3. Expose the tika server to the cluster

    bash tests/config/k8s/expose-external-svc.sh tika:9998
    
  4. 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:

  1. Check if setup step 3 is done correctly. (ENABLE_OCM=true)

  2. Prepare Charts for federation oCIS

    OCM=true make prepare-charts
    
  3. Deploy federation oCIS

    OCM=true make deploy-ocis
    
  4. 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:

  1. Check if setup step 3 is done correctly. (ENABLE_VAULT=true ENABLE_TIKA=true)

  2. Start postgres and Keycloak (self-signed cert, CN=keycloak, importing tests/config/ci/ocis-mfa-ci-realm.dist.json with https://localhost:9200 replaced by https://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
    
  3. 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
    
  4. Run the tests (Playwright is required for the @javascript/web-UI-login scenarios; run vendor-php/bin/playwright-install --browsers once 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.