aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-08-16 09:43:05 +0200
committerMauro Sardara <msardara@cisco.com>2022-08-17 17:58:36 +0200
commit309fafddc51697deb9c6f8bf723c10539224cb4d (patch)
tree5f50208043312c0ec0a7680d8ff2fc70f497085c /tests
parent7f18fb8e83a9cd4d32b6bf0eb39503cf2f551b4a (diff)
ci(functional-tests): add functional tests scripts
- Add scripts/functional-tests.sh script - Add `download_artifacts` functions, allowing to retrieve artifacts of a gerrit patch - Robot: redirect output of topology build to files, thus preventing robot from hanging - Share folders between host and containers with the :z flag - Use sudo to install executable in docker-compose scripts, as the user of the docker is not root anymore - Makefile: decouple installation and build Ref: HICN-732 Change-Id: Ib945cf7bd0ee331e33270cf1005dfebd085862eb Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/1-node.yml2
-rw-r--r--tests/2-nodes-hicn-light.yml4
-rw-r--r--tests/2-nodes-vpp-bridge.yml8
-rw-r--r--tests/2-nodes-vpp-memif-replication.yml12
-rw-r--r--tests/2-nodes-vpp-memif.yml12
-rw-r--r--tests/2-nodes.yml4
-rw-r--r--tests/build.yml41
-rwxr-xr-xtests/config.sh2
-rw-r--r--tests/resources/libraries/robot/common.robot2
9 files changed, 62 insertions, 25 deletions
diff --git a/tests/1-node.yml b/tests/1-node.yml
index be693c792..5b412d2fb 100644
--- a/tests/1-node.yml
+++ b/tests/1-node.yml
@@ -9,7 +9,7 @@ services:
container_name: forwarder
working_dir: /workspace
volumes:
- - ..:/workspace
+ - ..:/workspace:z
entrypoint: [/bin/bash, -ex, -c]
command:
- |
diff --git a/tests/2-nodes-hicn-light.yml b/tests/2-nodes-hicn-light.yml
index 674df3ea4..c0e22f9b7 100644
--- a/tests/2-nodes-hicn-light.yml
+++ b/tests/2-nodes-hicn-light.yml
@@ -5,7 +5,7 @@ services:
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo ip link add br0 type bridge
@@ -34,7 +34,7 @@ services:
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo ip link add br0 type bridge
diff --git a/tests/2-nodes-vpp-bridge.yml b/tests/2-nodes-vpp-bridge.yml
index 5a61874ac..f162c7b46 100644
--- a/tests/2-nodes-vpp-bridge.yml
+++ b/tests/2-nodes-vpp-bridge.yml
@@ -2,12 +2,10 @@ version: "3"
services:
client:
container_name: ${TEST_VPP_BRIDGE}-client
- volumes:
- - ..:/workspace
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo ip link add br0 type bridge
@@ -54,12 +52,10 @@ services:
server:
container_name: ${TEST_VPP_BRIDGE}-server
- volumes:
- - ..:/workspace
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo ip link add br0 type bridge
diff --git a/tests/2-nodes-vpp-memif-replication.yml b/tests/2-nodes-vpp-memif-replication.yml
index c5b0d3865..9fbb57a40 100644
--- a/tests/2-nodes-vpp-memif-replication.yml
+++ b/tests/2-nodes-vpp-memif-replication.yml
@@ -10,13 +10,13 @@ services:
container_name: ${TEST_VPP_MEMIF_REPLICATION}-client
hostname: client
volumes:
- - /tmp/memif:/memif
- - ..:/workspace
+ - /tmp/memif:/memif:z
+ - ..:/workspace:z
entrypoint: [/bin/bash, -c]
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo mkdir -p /var/log/vpp
@@ -79,13 +79,13 @@ services:
container_name: ${TEST_VPP_MEMIF_REPLICATION}-server
hostname: server
volumes:
- - /tmp/memif:/memif
- - ..:/workspace
+ - /tmp/memif:/memif:z
+ - ..:/workspace:z
entrypoint: [/bin/bash, -c]
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo mkdir -p /var/log/vpp
diff --git a/tests/2-nodes-vpp-memif.yml b/tests/2-nodes-vpp-memif.yml
index e02c947a6..ace522dc6 100644
--- a/tests/2-nodes-vpp-memif.yml
+++ b/tests/2-nodes-vpp-memif.yml
@@ -4,12 +4,12 @@ services:
container_name: ${TEST_VPP_MEMIF}-client
networks: []
volumes:
- - /tmp/memif:/memif
- - ..:/workspace
+ - /tmp/memif:/memif:z
+ - ..:/workspace:z
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo mkdir -p /var/log/vpp
@@ -61,12 +61,12 @@ services:
container_name: ${TEST_VPP_MEMIF}-server
networks: []
volumes:
- - /tmp/memif:/memif
- - ..:/workspace
+ - /tmp/memif:/memif:z
+ - ..:/workspace:z
command:
- |
if [ -d /workspace/build-dev ]; then
- ninja -C /workspace/build-dev install
+ sudo ninja -C /workspace/build-dev install
fi
sudo mkdir -p /var/log/vpp
diff --git a/tests/2-nodes.yml b/tests/2-nodes.yml
index e1740dbf7..064ed5453 100644
--- a/tests/2-nodes.yml
+++ b/tests/2-nodes.yml
@@ -12,7 +12,7 @@ services:
networks:
- kernel
volumes:
- - ..:/workspace
+ - ..:/workspace:z
entrypoint: [/bin/bash, -x, -c]
command:
- tail -f /dev/null
@@ -29,7 +29,7 @@ services:
networks:
- kernel
volumes:
- - ..:/workspace
+ - ..:/workspace:z
entrypoint: [/bin/bash, -x, -c]
command:
- tail -f /dev/null
diff --git a/tests/build.yml b/tests/build.yml
new file mode 100644
index 000000000..859262632
--- /dev/null
+++ b/tests/build.yml
@@ -0,0 +1,41 @@
+version: "3"
+services:
+ dev:
+ build:
+ context: ..
+ dockerfile: ${DOCKERFILE}
+ image: hicn-base
+ stdin_open: true
+ tty: true
+ working_dir: /workspace
+ container_name: dev
+ hostname: dev
+ environment:
+ - BUILD_SOFTWARE
+ volumes:
+ - ..:/workspace:z
+ entrypoint: [/bin/bash, -ex, -c]
+ command:
+ - |
+ whoami
+
+ if [[ "${BUILD_SOFTWARE}" -ne 1 ]]; then
+ exit 0
+ fi
+
+ if [[ ! -z "${REBUILD}" ]]; then
+ rm -fr build-dev
+ fi
+
+ git config --global --add safe.directory \*
+
+ mkdir -p build-dev
+ cd build-dev
+ cmake -G Ninja \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DBUILD_APPS=ON \
+ -DBUILD_TESTS=ON \
+ -DENABLE_RELY=OFF \
+ -DBUILD_HICNPLUGIN=ON ..
+ sudo ninja install
diff --git a/tests/config.sh b/tests/config.sh
index 9d8e80d62..2d8323a56 100755
--- a/tests/config.sh
+++ b/tests/config.sh
@@ -171,7 +171,7 @@ function error() {
function build() {
docker-compose -f build.yml build
- docker-compose -f build.yml up --force-recreate --remove-orphans >/dev/null
+ docker-compose -f build.yml up --force-recreate --remove-orphans
}
function setup() {
diff --git a/tests/resources/libraries/robot/common.robot b/tests/resources/libraries/robot/common.robot
index 7550db788..21d1ace1d 100644
--- a/tests/resources/libraries/robot/common.robot
+++ b/tests/resources/libraries/robot/common.robot
@@ -10,7 +10,7 @@ Library String
Build Topology
[Arguments] ${TEST_TOPOLOGY}=${NONE} ${TEST_CONFIGURATION}=${NONE}
Log to console Building topology ${TEST_TOPOLOGY} ${TEST_CONFIGURATION}
- ${result_setup} = Run Process ${EXECDIR}/config.sh build setup ${TEST_TOPOLOGY} ${TEST_CONFIGURATION}
+ ${result_setup} = Run Process ${EXECDIR}/config.sh build setup ${TEST_TOPOLOGY} ${TEST_CONFIGURATION} stdout=${TEMPDIR}/stdout.txt stderr=${TEMPDIR}/stderr.txt
Log to console Done
Log Many stdout: ${result_setup.stdout} stderr: ${result_setup.stderr}
Should Be Equal As Integers ${result_setup.rc} 0