Repair A1 integration tests 54/3454/7
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 24 Apr 2020 15:52:42 +0000 (11:52 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Mon, 27 Apr 2020 17:42:22 +0000 (13:42 -0400)
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

14 files changed:
docs/developer-guide.rst
integration_tests/a1mediator/Chart.yaml
integration_tests/dbaas-service/templates/deployment.yaml
integration_tests/portforward.sh
integration_tests/test_a1.tavern.yaml
integration_tests/testxappcode/Dockerfile-delay-receiver [changed mode: 0755->0644]
integration_tests/testxappcode/Dockerfile-query-receiver [changed mode: 0755->0644]
integration_tests/testxappcode/Dockerfile-test-receiver [changed mode: 0755->0644]
integration_tests/testxappcode/delay-config-file.yaml [changed mode: 0755->0644]
integration_tests/testxappcode/go.mod [changed mode: 0755->0644]
integration_tests/testxappcode/query-config-file.yaml [changed mode: 0755->0644]
integration_tests/testxappcode/receiver.go [changed mode: 0755->0644]
integration_tests/testxappcode/test-config-file.yaml [changed mode: 0755->0644]
tox-integration.ini

index 5e18ca5..f562c7c 100644 (file)
@@ -74,13 +74,17 @@ Alternatively, you can run the unit tests in Docker (this is somewhat less nice
 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``).
index ed7135f..5184751 100644 (file)
@@ -1,4 +1,4 @@
 apiVersion: v1
 description: A1 Helm chart for Kubernetes
 name: a1mediator
-version: 2.1.6
+version: 2.1.7
index 341d898..8446b8e 100644 (file)
 #   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:
index 09d2a8e..10d19b7 100755 (executable)
@@ -1,3 +1,4 @@
 #!/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 &
-
index bdd8d45..e33b3da 100644 (file)
@@ -172,9 +172,8 @@ stages:
         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
old mode 100755 (executable)
new mode 100644 (file)
index 5f1d2b0..42303e0
@@ -34,7 +34,7 @@ RUN go build -a -installsuffix cgo -o receiver receiver.go
 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 .
old mode 100755 (executable)
new mode 100644 (file)
index ce861b6..c3c98e0
@@ -34,7 +34,7 @@ RUN go build -a -installsuffix cgo -o receiver receiver.go
 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 .
old mode 100755 (executable)
new mode 100644 (file)
index 6e32831..b7afc4a
@@ -34,7 +34,7 @@ RUN go build -a -installsuffix cgo -o receiver receiver.go
 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 .
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 428d14b..c19899c 100644 (file)
@@ -28,20 +28,20 @@ whitelist_externals=
     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
@@ -50,20 +50,25 @@ commands_pre=
     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