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 name: smokeping_prober:image:build
parent: opendev-build-docker-image parent: opendev-build-docker-image
provides: smokeping_prober:image provides: smokeping_prober:image
dependencies:
- opendev-buildset-registry
files: &smokeping_prober_files files: &smokeping_prober_files
- Dockerfile - Dockerfile
vars: &smokeping_prober_images vars: &smokeping_prober_images
@ -31,6 +33,8 @@
provides: smokeping_prober:image provides: smokeping_prober:image
files: *smokeping_prober_files files: *smokeping_prober_files
vars: *smokeping_prober_images vars: *smokeping_prober_images
dependencies:
- opendev-buildset-registry
secrets: secrets:
- name: docker_credentials - name: docker_credentials
secret: smokeping-dockerhub secret: smokeping-dockerhub
@ -46,14 +50,40 @@
secret: smokeping-dockerhub secret: smokeping-dockerhub
pass-to-parent: true 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: - project:
check: check:
jobs: jobs:
- opendev-buildset-registry
- chart-testing-lint - chart-testing-lint
- smokeping_prober-helm:functional:
dependencies:
- name: opendev-buildset-registry
- name: smokeping_prober:image:build
soft: true
- smokeping_prober:image:build - smokeping_prober:image:build
gate: gate:
jobs: jobs:
- opendev-buildset-registry
- chart-testing-lint - chart-testing-lint
- smokeping_prober-helm:functional:
dependencies:
- name: opendev-buildset-registry
- name: smokeping_prober:image:upload
soft: true
- smokeping_prober:image:upload - smokeping_prober:image:upload
promote: promote:
jobs: jobs:

View File

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

View File

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

View File

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