Added functional tests

Change-Id: I9a07147e1bc2c79b4ff5773bf5c2d4a44cfc694a
This commit is contained in:
Mohammed Naser 2020-03-29 11:22:20 -04:00
parent 7ae39f46ec
commit 2a095fac7c
5 changed files with 63 additions and 8 deletions

View File

@ -18,6 +18,8 @@
name: smokeping_prober:image:build
parent: opendev-build-docker-image
provides: smokeping_prober:image
dependencies:
- opendev-buildset-registry
files: &smokeping_prober_files
- Dockerfile
vars: &smokeping_prober_images
@ -31,6 +33,8 @@
provides: smokeping_prober:image
files: *smokeping_prober_files
vars: *smokeping_prober_images
dependencies:
- opendev-buildset-registry
secrets:
- name: docker_credentials
secret: smokeping-dockerhub
@ -46,14 +50,40 @@
secret: smokeping-dockerhub
pass-to-parent: true
- job:
name: smokeping_prober-helm:functional
parent: apply-helm-charts
requires:
- smokeping_prober:image
run: playbooks/functional/run.yaml
vars:
docker_use_buildset_registry: true
minikube_dns_resolvers: ['1.1.1.1', '8.8.8.8']
- job:
name: smokeping_prober-helm:functional
parent: opendev-buildset-registry-consumer
- project:
check:
jobs:
- opendev-buildset-registry
- chart-testing-lint
- smokeping_prober-helm:functional:
dependencies:
- name: opendev-buildset-registry
- name: smokeping_prober:image:build
soft: true
- smokeping_prober:image:build
gate:
jobs:
- opendev-buildset-registry
- chart-testing-lint
- smokeping_prober-helm:functional:
dependencies:
- name: opendev-buildset-registry
- name: smokeping_prober:image:upload
soft: true
- smokeping_prober:image:upload
promote:
jobs:

View File

@ -31,16 +31,20 @@ spec:
- --privileged
- --log.level=info
{{- range .Values.hosts }}
- "{{ .ip }}"
- "{{ . }}"
{{- end }}
ports:
- name: http
- name: metrics
containerPort: 9374
protocol: TCP
readinessProbe:
httpGet:
path: /
port: metrics
livenessProbe:
httpGet:
path: /
port: http
port: metrics
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}

View File

@ -8,7 +8,7 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: metrics
protocol: TCP
name: http
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}

View File

@ -5,7 +5,7 @@
replicaCount: 1
image:
repository: vexxhost/smokeping
repository: vexxhost/smokeping-prober
version: latest
pullPolicy: IfNotPresent
@ -25,12 +25,11 @@ securityContext: {}
# runAsUser: 1000
hosts:
- ip: localhost
- localhost
service:
type: NodePort
type: ClusterIP
port: 80
nodePort: 30080
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious

View File

@ -0,0 +1,22 @@
- hosts: all
roles:
- role: helm-template
vars:
helm_release_name: smokeping-prober
helm_chart: ./charts/smokeping-prober
tasks:
- name: Get the port
command: >
kubectl get svc/smokeping-prober -ojsonpath="http://{.spec.clusterIP}:{.spec.ports[0].port}"
register: _url
- name: Wait for a few seconds for the prober to gather data
pause:
seconds: 10
- name: Get data back from the prober
uri:
url: "{{ _url.stdout }}/metrics"
return_content: true
register: _probe
failed_when: "'smokeping_response_duration_seconds_bucket{host=\"localhost\"' not in _probe.content"