Correct COPY command in Dockerfiles to get all files for RMR, not just one.
Pin the version of tavern to 0.34.0, because the latest (1.0.0) changed
the required format of the test-spec file and rejects this one.
Add delay before test AC policy status get to increase chance of success.
Adjust tox ini file for shell-script path and to be a bit more verbose.
Bump version in the a1 chart to 2.1.7.
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I96dc018aa80e6bfcbf9c28068129e6cca1611d15
Integration testing
-------------------
-This tests A1’s external API with three test receivers. This depends on helm+k8s.
+This tests A1’s external API with three test receivers. This requires docker, kubernetes and helm.
-Build all the containers:
+Build all the images:
::
- docker build -t a1:latest .; cd integration_tests/; docker build -t testreceiver:latest . -f Dockerfile-test-delay-receiver; docker build -t queryreceiver:latest . -f Dockerfile-query-receiver; cd ..
+ docker build -t a1:latest .
+ cd integration_tests/testxappcode
+ docker build -t delayreceiver:latest -f Dockerfile-delay-receiver .
+ docker build -t queryreceiver:latest -f Dockerfile-query-receiver .
+ docker build -t testreceiver:latest -f Dockerfile-test-receiver .
Then, run all the tests from the root (this requires the python packages ``tox``, ``pytest``, and ``tavern``).
apiVersion: v1
description: A1 Helm chart for Kubernetes
name: a1mediator
-version: 2.1.6
+version: 2.1.7
# platform project (RICP).
#
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.backend.name }}
spec:
replicas: {{ .Values.backend.replicas }}
+ selector:
+ matchLabels:
+ app: {{ .Values.backend.name }}
template:
metadata:
labels:
#!/bin/bash
+# fail on error
+set -eux
kubectl port-forward $(kubectl get pods --namespace default -l "app.kubernetes.io/name=a1mediator,app.kubernetes.io/instance=a1" -o jsonpath="{.items[0].metadata.name}") 10000:10000 2>&1 > forward.log &
-
blocking_rate: 20
trigger_threshold: 10
-
- name: test the admission control policy status get
- delay_before: 3 # give it a few seconds for rmr
+ delay_before: 10 # give it a few seconds for rmr
request:
url: http://localhost:10000/a1-p/policytypes/6660666/policies/admission_control_policy/status
method: GET
FROM alpine:3.11
# copy rmr .so from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so
+COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so* /usr/local/lib64/
COPY --from=0 /myxapp/receiver .
COPY delay-config-file.yaml .
FROM alpine:3.11
# copy rmr .so from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so
+COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so* /usr/local/lib64/
COPY --from=0 /myxapp/receiver .
COPY query-config-file.yaml .
FROM alpine:3.11
# copy rmr .so from builder image in lieu of an Alpine package
-COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so /usr/local/lib64/librmr_si.so
+COPY --from=nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-alpine3-rmr:3.8.0 /usr/local/lib64/librmr_si.so* /usr/local/lib64/
COPY --from=0 /myxapp/receiver .
COPY test-config-file.yaml .
getlogs.sh
passenv = *
deps =
- tavern
+ tavern == 0.34.0 # version 1.0 uses different schema; body -> json
changedir=integration_tests
commands_pre=
- echo "WARNING: make sure you're running with latest docker builds!"
+ echo "WARNING: make sure you are running with latest docker builds!"
# Fish function that builds and tags the 3 receivers. Run from integration_tests/testxappcode/
#function a1intbuild
# docker build -t a1:latest .
# cd integration_tests/testxappcode
-# docker build -t testreceiver:latest . -f Dockerfile-test-receiver
+# docker build -t testreceiver:latest . -f Dockerfile-test-receiver
# docker build -t delayreceiver:latest . -f Dockerfile-delay-receiver
# docker build -t queryreceiver:latest . -f Dockerfile-query-receiver
# cd ../..
#end
- sleep 5
+ sleep 3
# helm v3 is helm install [name] [chart]
echo "linting"
helm lint a1mediator
helm install --devel testreceiver testreceiver
helm install --devel a1 a1mediator
helm install --devel dbaas dbaas-service
-# wait for helm charts
+ kubectl get pods --namespace=default
+ echo "wait for pods to start"
sleep 30
+ kubectl get pods --namespace=default
+ echo "forward ports"
./portforward.sh
- sleep 2
+ echo "wait for port forward"
+ sleep 5
commands=
- echo "running tavern"
-# run tavern
+ echo "running tavern via pytest"
+ pytest --version
+ # --tavern-beta-new-traceback for 0.34.0; fails in 1.0.0
pytest --tavern-beta-new-traceback test_a1.tavern.yaml
- echo "running ab"
-# run apache bench
- ab -n 100 -c 10 -v 4 http://localhost:10000/a1-p/healthcheck
+ echo "running apache bench (ab) on healthcheck endpoint"
+ # use -v 4 to make ab chatty
+ ab -n 100 -c 10 -v 0 http://localhost:10000/a1-p/healthcheck
commands_post=
echo "log collection"
- integration_tests/getlogs.sh
+ ./getlogs.sh
echo "teardown"
helm delete testreceiver
helm delete a1