File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 port : 4190
3838 protocol : TCP
3939 targetPort : managesieve
40+ - name : doveadm
41+ port : 8080
42+ protocol : TCP
43+ targetPort : doveadm
4044 selector :
4145 app.kubernetes.io/name : mda
4246 app.kubernetes.io/component : mail
Original file line number Diff line number Diff line change 6666 - name : managesieve
6767 containerPort : 4190
6868 protocol : TCP
69+ - name : doveadm
70+ containerPort : 8080
71+ protocol : TCP
6972 livenessProbe :
7073 exec :
7174 command :
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ ENV MYSQL_HOST=db \
1010 MYSQL_DATABASE=mailserver \
1111 FILTER_WEB_ADDRESS=filter:11334 \
1212 IS_KUBERNETES=0 \
13+ KUBECTL_CONFIG=/tmp/kubeconfig \
1314 MDA_POP3_ADDRESS=mda:31110 \
1415 MDA_IMAP_ADDRESS=mda:31143 \
1516 MDA_POP3S_ADDRESS=mda:31995 \
@@ -56,8 +57,7 @@ RUN apk --no-cache add \
5657RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ swaks=20240103.0-r0
5758
5859COPY --from=dockerize /bin/dockerize /usr/local/bin/dockerize
59- COPY _helpers/dockerlogs.sh /usr/local/bin/dockerlogs.sh
60- COPY _helpers/entrypoint.sh /entrypoint.sh
60+ COPY rootfs/ /
6161
6262WORKDIR /app/tests
6363COPY integration/ /app/tests/
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bats
2+
3+ setup () {
4+ load ' _helper'
5+ skip_in_non_kubernetes
6+ }
7+
8+ @test " Moved mail was sent to rspamd and learned successfully" {
9+ run bash -c " kubectl logs statefulset/filter | grep 'learned message as spam:' | grep rspamd_controller_learn_fin_task"
10+
11+ [ " $status " -eq 0 ]
12+ }
13+
14+ @test " system:check command succeeds" {
15+ run kubectl exec deploy/web -c web -- /opt/admin/bin/console system:check --all
16+
17+ [ " $status " -eq 0 ]
18+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ skip_in_kubernetes() {
66 fi
77}
88
9+ skip_in_non_kubernetes () {
10+ if [ " ${IS_KUBERNETES} " -ne " 1" ]; then
11+ skip " Skipping test in non-Kubernetes"
12+ fi
13+ }
14+
915# Split a string by colon (:) character and return both parts
1016# Usage: split_by_colon "hostname:8080"
1117# Returns: Two lines - first part on line 1, second part on line 2
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ if [ " ${IS_KUBERNETES} " -eq " 1" ]; then
4+ /usr/local/bin/kubectl.sh
5+ fi
6+
37exec dockerize \
48 -wait " tcp://${MYSQL_HOST} :${MYSQL_PORT} " \
59 -wait " tcp://${FILTER_WEB_ADDRESS} " \
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ SA_DIR=" /var/run/secrets/kubernetes.io/serviceaccount"
4+ APISERVER=" https://${KUBERNETES_SERVICE_HOST} :${KUBERNETES_SERVICE_PORT} "
5+ TOKEN=" $( cat ${SA_DIR} /token) "
6+ CACERT=" ${SA_DIR} /ca.crt"
7+ NAMESPACE=" $( cat ${SA_DIR} /namespace) "
8+
9+ cat > /tmp/kubeconfig << EOF
10+ apiVersion: v1
11+ kind: Config
12+ clusters:
13+ - cluster:
14+ certificate-authority: ${CACERT}
15+ server: ${APISERVER}
16+ name: in-cluster
17+ contexts:
18+ - context:
19+ cluster: in-cluster
20+ namespace: ${NAMESPACE}
21+ user: sa
22+ name: sa@in-cluster
23+ current-context: sa@in-cluster
24+ users:
25+ - name: sa
26+ user:
27+ token: ${TOKEN}
28+ EOF
Original file line number Diff line number Diff line change 1616 app.kubernetes.io/component : test
1717 app.kubernetes.io/part-of : docker-mailserver
1818 spec :
19- automountServiceAccountToken : false
19+ automountServiceAccountToken : true
20+ serviceAccountName : test-runner-sa
2021 restartPolicy : Never
2122 initContainers :
2223 - name : load-fixtures
2829 args :
2930 - |
3031 /opt/admin/bin/console system:check --wait
31- /opt/admin/bin/console domain:add example.com
32+ /opt/admin/bin/console domain:add example.com || exit 0
3233 /opt/admin/bin/console domain:add example.org
3334 /opt/admin/bin/console user:add --admin --password=changeme --enable admin example.com
3435 /opt/admin/bin/console user:add --password=test1234 --enable --sendonly sendonly example.com
@@ -109,3 +110,29 @@ spec:
109110 - name : vmail
110111 persistentVolumeClaim :
111112 claimName : mda-data-mda-0
113+ ---
114+ apiVersion : v1
115+ kind : ServiceAccount
116+ metadata :
117+ name : test-runner-sa
118+ labels :
119+ app.kubernetes.io/name : test-runner-sa
120+ app.kubernetes.io/component : test
121+ app.kubernetes.io/part-of : docker-mailserver
122+ ---
123+ apiVersion : rbac.authorization.k8s.io/v1
124+ kind : ClusterRoleBinding
125+ metadata :
126+ name : test-runner-cluster-admin
127+ labels :
128+ app.kubernetes.io/name : test-runner-cluster-admin
129+ app.kubernetes.io/component : test
130+ app.kubernetes.io/part-of : docker-mailserver
131+ roleRef :
132+ apiGroup : rbac.authorization.k8s.io
133+ kind : ClusterRole
134+ name : cluster-admin
135+ subjects :
136+ - kind : ServiceAccount
137+ name : test-runner-sa
138+ namespace : default
You can’t perform that action at this time.
0 commit comments