Skip to content

Commit 624a53e

Browse files
committed
docs: add docs for running test on kubernetes
1 parent 0247785 commit 624a53e

File tree

1 file changed

+92
-3
lines changed

1 file changed

+92
-3
lines changed

docs/ocis/development/testing.md

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ WEB_UI_CONFIG_FILE="tests/config/local/ocis-web.json" \
532532
ocis/bin/ocis server
533533
```
534534

535-
The first oCIS instance should be available at: https://localhost:9200/
535+
The first oCIS instance should be available at: <https://localhost:9200/>
536536

537537
### Setup Second oCIS Instance
538538

@@ -552,7 +552,7 @@ source tests/config/local/.env-federation && ocis/bin/ocis init
552552
ocis/bin/ocis server
553553
```
554554

555-
The second oCIS instance should be available at: https://localhost:10200/
555+
The second oCIS instance should be available at: <https://localhost:10200/>
556556

557557
{{< hint info >}}
558558
To enable ocm in the web interface, you need to set the following envs:
@@ -589,6 +589,95 @@ The sample `fontsMap.json` file is located in `tests/config/drone/fontsMap.json`
589589
}
590590
```
591591

592+
## Running Test on helm setup
593+
594+
Make sure the following tools are installed:
595+
596+
Install [k3d](https://k3d.io/stable/#install-script)
597+
Install [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
598+
Install [helm](https://helm.sh/docs/intro/install/)
599+
600+
Also, clone the [`ocis-charts`](https://github.com/owncloud/ocis-charts/) repository.
601+
602+
1. Setup Basicauth
603+
Enable basic authentication for the proxy in the ocis-charts repo:
604+
```bash
605+
cd ocis-charts
606+
# Enable basic auth in proxy deployment
607+
sed -i '/- name: PROXY_HTTP_ADDR/i\
608+
- name: PROXY_ENABLE_BASIC_AUTH\
609+
value: "true"' ./charts/ocis/templates/proxy/deployment.yaml
610+
```
611+
612+
613+
614+
```bash
615+
# copy authbasic service
616+
cp -r <path-to-ocis-repo>/tests/config/drone/k3s/authbasic ./charts/ocis/templates/
617+
# change admin password
618+
sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml
619+
sed -i '/- name: IDM_ADMIN_PASSWORD/a\\n value: "admin"' ./charts/ocis/templates/idm/deployment.yaml
620+
# Update values.yaml
621+
cp <path-to-ocis-repo>/tests/config/drone/k3s/values.yaml charts/charts/ocis/ci/deployment-values.yaml
622+
# Update template values
623+
sed -i '/{{- $_ := set .scope "appNameAuthMachine" "authmachine" -}}/a\ {{- $_ := set .scope "appNameAuthBasic" "authbasic" -}}' ./charts/ocis/templates/_common/_tplvalues.tpl
624+
```
625+
626+
2. Install charts using k3d
627+
628+
```bash
629+
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:*'
630+
k3d kubeconfig get drone > kubeconfig.yaml
631+
chmod 0600 kubeconfig.yaml
632+
kubectl create configmap coredns-custom --namespace kube-system --from-literal='rewritehost.override=rewrite name exact ocis-server host.k3d.internal'
633+
kubectl -n kube-system rollout restart deployment coredns
634+
make helm-install-atomic
635+
```
636+
637+
3. Run test
638+
To run test you should set `K8S` to true.
639+
```bash
640+
cd ../ocis
641+
642+
# build and run ocis wrapper
643+
make -C ./tests/ociswrapper
644+
./tests/ociswrapper/bin/ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run
645+
646+
K8S=true TEST_SERVER_URL="ocis-server" make test-acceptance-api BEHAT_FEATURE=tests/acceptance/features/apiArchiver/downloadById.feature
647+
```
648+
1. Run Test With ociswrapper
649+
```bash
650+
ociswrapper serve --url https://ocis-server --admin-username admin --admin-password admin --skip-ocis-run
651+
```
652+
1. Run Antivirus Test
653+
To run clamav service run these command deploying the helm chart
654+
```bash
655+
cp -r config/drone/k8s/clamav charts/ocis/templates/
656+
sed -i 's/{{ *\.Values\.features\.virusscan\.infectedFileHandling *| *quote *}}/"delete"/' ocis/templates/antivirus/deployment.yaml
657+
sed -i 's/{{ *\.Values\.features\.virusscan\.infectedFileHandling *| *quote *}}/"delete"/' ocis/templates/antivirus/deployment.yaml
658+
sed -i '/name: ANTIVIRUS_SCANNER_TYPE/{n;s/value: *"icap"/value: "clamav"/}' charts/ocis/templates/antivirus/deployment.yaml
659+
sed -i '/- name: ANTIVIRUS_SCANNER_TYPE/i\ - name: ANTIVIRUS_CLAMAV_SOCKET\n value: "tcp://clamav:3310"' charts/ocis/templates/antivirus/deployment.yaml
660+
```
661+
1. Run Email Test
662+
To run email service run these command deploying the helm chart
663+
```bash
664+
cp -r <path-to-ocis-repo>/tests/config/drone/k8s/mailpit charts/ocis/templates/
665+
```
666+
After ocis is deployed
667+
```bash
668+
kubectl port-forward svc/mailpit $EMAIL_PORT:8025 -n ocis
669+
```
670+
1. Run Authapp Test
671+
To run authapp service run these command deploying the helm chart
672+
```bash
673+
cp -r <path-to-ocis-repo>/tests/config/drone/k8s/mailpit charts/ocis/templates/
674+
```
675+
1. Run Tika Test
676+
To run tika service run these command deploying the helm chart
677+
```bash
678+
cp -r <path-to-ocis-repo>/tests/config/drone/k8s/tika charts/ocis/templates/
679+
```
680+
592681
## Generating Code Coverage Report by Running Acceptance Tests
593682

594683
To find out what oCIS code is covered by the API tests, first create a debug build of oCIS.
@@ -623,4 +712,4 @@ You can also view the report in a web UI using the following command.
623712
go tool cover -html=cov.txt
624713
```
625714

626-
This command should open a browser with the code report.
715+
This command should open a browser with the code report.

0 commit comments

Comments
 (0)