diff --git a/docs/ocis/development/testing.md b/docs/ocis/development/testing.md index 471dc184898..576c70eac22 100644 --- a/docs/ocis/development/testing.md +++ b/docs/ocis/development/testing.md @@ -532,7 +532,7 @@ WEB_UI_CONFIG_FILE="tests/config/local/ocis-web.json" \ ocis/bin/ocis server ``` -The first oCIS instance should be available at: https://localhost:9200/ +The first oCIS instance should be available at: ### Setup Second oCIS Instance @@ -552,7 +552,7 @@ source tests/config/local/.env-federation && ocis/bin/ocis init ocis/bin/ocis server ``` -The second oCIS instance should be available at: https://localhost:10200/ +The second oCIS instance should be available at: {{< hint info >}} To enable ocm in the web interface, you need to set the following envs: @@ -589,6 +589,90 @@ The sample `fontsMap.json` file is located in `tests/config/drone/fontsMap.json` } ``` +## Running Test on helm setup + +Make sure the following tools are installed: + +Install [k3d](https://k3d.io/stable/#install-script) +Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) +Install [helm](https://helm.sh/docs/intro/install/) + +Also, clone the [`ocis-charts`](https://github.com/owncloud/ocis-charts/) repository. + +1. Setup Basicauth +Enable basic authentication for the proxy in the ocis-charts repo: +```bash +cd ocis-charts +# Enable basic auth in proxy deployment +sed -i '/- name: PROXY_HTTP_ADDR/i\ + - name: PROXY_ENABLE_BASIC_AUTH\ + value: "true"' ./charts/ocis/templates/proxy/deployment.yaml +# copy authbasic service +cp -r /tests/config/drone/k3s/authbasic ./charts/ocis/templates/ +# change admin password +sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml +sed -i '/- name: IDM_ADMIN_PASSWORD/a\\n value: "admin"' ./charts/ocis/templates/idm/deployment.yaml +# Update values.yaml +cp /tests/config/drone/k3s/values.yaml charts/charts/ocis/ci/deployment-values.yaml +# Update template values +sed -i '/{{- $_ := set .scope "appNameAuthMachine" "authmachine" -}}/a\ {{- $_ := set .scope "appNameAuthBasic" "authbasic" -}}' ./charts/ocis/templates/_common/_tplvalues.tpl +``` + +2. Install charts using k3d + +```bash +k3d cluster create drone --api-port ocis-server:33199 -p '80:80@loadbalancer' -p '443:443@loadbalancer' --k3s-arg '--tls-san=k3d@server:*' --k3s-arg '--disable=metrics-server@server:*' +k3d kubeconfig get drone > kubeconfig.yaml +chmod 0600 kubeconfig.yaml +kubectl create configmap coredns-custom --namespace kube-system --from-literal='rewritehost.override=rewrite name exact ocis-server host.k3d.internal' +kubectl -n kube-system rollout restart deployment coredns +make helm-install-atomic +``` + +3. Run test +To run test you should set `K8S` to true. +```bash +cd ../ocis + +# build and run ocis wrapper +make -C ./tests/ociswrapper +./tests/ociswrapper/bin/ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run + +K8S=true TEST_SERVER_URL="https://ocis-server" make test-acceptance-api BEHAT_FEATURE=tests/acceptance/features/apiArchiver/downloadById.feature +``` +1. Run Test With ociswrapper +```bash +ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run +``` +1. Run Antivirus Test +To run clamav service run these command deploying the helm chart +```bash +cp -r config/drone/k8s/clamav charts/ocis/templates/ +sed -i 's/{{ *\.Values\.features\.virusscan\.infectedFileHandling *| *quote *}}/"delete"/' ocis/templates/antivirus/deployment.yaml +sed -i 's/{{ *\.Values\.features\.virusscan\.infectedFileHandling *| *quote *}}/"delete"/' ocis/templates/antivirus/deployment.yaml +sed -i '/name: ANTIVIRUS_SCANNER_TYPE/{n;s/value: *"icap"/value: "clamav"/}' charts/ocis/templates/antivirus/deployment.yaml +sed -i '/- name: ANTIVIRUS_SCANNER_TYPE/i\ - name: ANTIVIRUS_CLAMAV_SOCKET\n value: "tcp://clamav:3310"' charts/ocis/templates/antivirus/deployment.yaml +``` +1. Run Email Test +To run email service run these command deploying the helm chart +```bash +cp -r /tests/config/drone/k8s/mailpit charts/ocis/templates/ +``` +After ocis is deployed +```bash +kubectl port-forward svc/mailpit $EMAIL_PORT:8025 -n ocis +``` +1. Run Authapp Test +To run authapp service run these command deploying the helm chart +```bash +cp -r /tests/config/drone/k8s/mailpit charts/ocis/templates/ +``` +1. Run Tika Test +To run tika service run these command deploying the helm chart +```bash +cp -r /tests/config/drone/k8s/tika charts/ocis/templates/ +``` + ## Generating Code Coverage Report by Running Acceptance Tests To find out what oCIS code is covered by the API tests, first create a debug build of oCIS. @@ -623,4 +707,4 @@ You can also view the report in a web UI using the following command. go tool cover -html=cov.txt ``` -This command should open a browser with the code report. \ No newline at end of file +This command should open a browser with the code report.