Skip to content

Commit

Permalink
added tests to bblfshd chart
Browse files Browse the repository at this point in the history
Tests have been written in Python using bblfsh python client as we
don't have a bblfsh cli yet that we can download easily for these tests
(see bblfsh/go-client#115)

Signed-off-by: Rafael Porres Molina <[email protected]>
  • Loading branch information
Rafael Porres Molina committed Jun 28, 2019
1 parent 7d9a9a3 commit 7260bfd
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
1 change: 0 additions & 1 deletion ct-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ chart-dirs:
# Some are included as they do not have the required dependancies to test
excluded-charts:
- bblfsh-web
- bblfshd
- bblfshd-sidecar
- borges
- drone
Expand Down
3 changes: 3 additions & 0 deletions stable/bblfshd/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
image:
tag: latest-drivers
pullPolicy: Always
21 changes: 21 additions & 0 deletions stable/bblfshd/templates/tests/test-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-test
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
tests.py: |-
import unittest
import bblfsh
class TestConnection(unittest.TestCase):
def test_connection(self):
client = bblfsh.BblfshClient("{{ template "fullname" . }}:{{ .Values.service.externalPort }}")
self.assertNotEqual(client.parse(__file__), '')
if __name__ == '__main__':
unittest.main()
26 changes: 26 additions & 0 deletions stable/bblfshd/templates/tests/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ template "fullname" . }}-test"
annotations:
"helm.sh/hook": test-success
spec:
volumes:
- name: tests
configMap:
name: {{ template "fullname" . }}-test
containers:
- name: {{ .Release.Name }}-test
image: python:3.7-slim
volumeMounts:
- name: tests
mountPath: /tests
command:
- sh
- -c
- |
apt-get update
apt-get install -y gcc make g++
pip install bblfsh
python /tests/tests.py
restartPolicy: Never

0 comments on commit 7260bfd

Please sign in to comment.