tests: Install CNI configuration files by default
Since we no longer fall back to the noop plugin when CNI configuration files are missing, and since the default sandbox_config.json test file is running without host networking, we must install the bridge and loopback configuration files by default for tests to pass. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
63c7a7c99b
commit
07ccda3395
3 changed files with 19 additions and 35 deletions
|
@ -37,6 +37,18 @@ $ cd bats
|
|||
$ ./install.sh /usr/local
|
||||
```
|
||||
|
||||
You will also need to install the [CNI](https://github.com/containernetworking/cni) plugins as
|
||||
the the default pod test template runs without host networking:
|
||||
|
||||
```
|
||||
$ go get github.com/containernetworking/cni
|
||||
$ cd "$GOPATH/src/github.com/containernetworking/cni"
|
||||
$ git checkout -q d4bbce1865270cd2d2be558d6a23e63d314fe769
|
||||
$ ./build.sh \
|
||||
$ mkdir -p /opt/cni/bin \
|
||||
$ cp bin/* /opt/cni/bin/
|
||||
```
|
||||
|
||||
Then you can run the tests on your host:
|
||||
```
|
||||
$ sudo make localintegration
|
||||
|
|
|
@ -63,8 +63,6 @@ POD_CIDR_MASK="10.88.*.*"
|
|||
|
||||
cp "$CONMON_BINARY" "$TESTDIR/conmon"
|
||||
|
||||
mkdir -p $OCID_CNI_CONFIG
|
||||
|
||||
PATH=$PATH:$TESTDIR
|
||||
|
||||
# Make sure we have a copy of the redis:latest image.
|
||||
|
@ -149,6 +147,10 @@ function start_ocid() {
|
|||
fi
|
||||
"$COPYIMG_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --image-name=redis --import-from=dir:"$ARTIFACTS_PATH"/redis-image --add-name=docker://docker.io/library/redis:latest --signature-policy="$INTEGRATION_ROOT"/policy.json
|
||||
"$OCID_BINARY" --conmon "$CONMON_BINARY" --listen "$OCID_SOCKET" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/ocid" --runroot "$TESTDIR/ocid-run" --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$OCID_CNI_CONFIG" --signature-policy "$INTEGRATION_ROOT"/policy.json --config /dev/null config >$OCID_CONFIG
|
||||
|
||||
# Prepare the CNI configuration files, we're running with non host networking by default
|
||||
prepare_network_conf $POD_CIDR
|
||||
|
||||
"$OCID_BINARY" --debug --config "$OCID_CONFIG" & OCID_PID=$!
|
||||
wait_until_reachable
|
||||
|
||||
|
@ -209,6 +211,8 @@ function stop_ocid() {
|
|||
wait "$OCID_PID"
|
||||
rm -f "$OCID_CONFIG"
|
||||
fi
|
||||
|
||||
cleanup_network_conf
|
||||
}
|
||||
|
||||
function restart_ocid() {
|
||||
|
@ -255,6 +259,7 @@ function is_apparmor_enabled() {
|
|||
}
|
||||
|
||||
function prepare_network_conf() {
|
||||
mkdir -p $OCID_CNI_CONFIG
|
||||
cat >$OCID_CNI_CONFIG/10-ocid.conf <<-EOF
|
||||
{
|
||||
"cniVersion": "0.2.0",
|
||||
|
|
|
@ -3,16 +3,6 @@
|
|||
load helpers
|
||||
|
||||
@test "Check for valid pod netns CIDR" {
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then
|
||||
skip "missing CNI bridge plugin, please install it"
|
||||
fi
|
||||
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/host-local" ]; then
|
||||
skip "missing CNI host-local IPAM, please install it"
|
||||
fi
|
||||
|
||||
prepare_network_conf $POD_CIDR
|
||||
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
|
@ -22,21 +12,10 @@ load helpers
|
|||
check_pod_cidr $pod_id
|
||||
|
||||
cleanup_pods
|
||||
cleanup_network_conf
|
||||
stop_ocid
|
||||
}
|
||||
|
||||
@test "Ping pod from the host" {
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then
|
||||
skip "missing CNI bridge plugin, please install it"
|
||||
fi
|
||||
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/host-local" ]; then
|
||||
skip "missing CNI host-local IPAM, please install it"
|
||||
fi
|
||||
|
||||
prepare_network_conf $POD_CIDR
|
||||
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
|
@ -46,21 +25,10 @@ load helpers
|
|||
ping_pod $pod_id
|
||||
|
||||
cleanup_pods
|
||||
cleanup_network_conf
|
||||
stop_ocid
|
||||
}
|
||||
|
||||
@test "Ping pod from another pod" {
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then
|
||||
skip "missing CNI bridge plugin, please install it"
|
||||
fi
|
||||
|
||||
if [ ! -f "$OCID_CNI_PLUGIN/host-local" ]; then
|
||||
skip "missing CNI host-local IPAM, please install it"
|
||||
fi
|
||||
|
||||
prepare_network_conf $POD_CIDR
|
||||
|
||||
start_ocid
|
||||
run ocic pod run --config "$TESTDATA"/sandbox_config.json
|
||||
echo "$output"
|
||||
|
@ -81,6 +49,5 @@ load helpers
|
|||
[ "$status" -eq 0 ]
|
||||
|
||||
cleanup_pods
|
||||
cleanup_network_conf
|
||||
stop_ocid
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue