Skip to content

Commit 10c0e0b

Browse files
committed
Test networkpolicy plugin in extended networking test, if the kernel supports it
1 parent 30d5835 commit 10c0e0b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/extended/networking.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,25 @@ function disable-selinux() {
313313
fi
314314
}
315315

316+
function kernel-supports-networkpolicy() {
317+
# There's really no good way to test this "correctly" if OVS isn't installed.
318+
# The mainline kernel got support for OVS conntrack in 4.3. RHEL kernels have
319+
# it in 3.10.0-514 and later.
320+
version="$(uname -r)"
321+
case "${version}" in
322+
3.10.0-*.el7.*)
323+
build=$(sed -e 's/.*-\([0-9]*\)\..*/\1/' <<< "${version}")
324+
if [[ "${build}" -lt 514 ]]; then
325+
return 1
326+
fi
327+
;;
328+
[0-3].*|4.[0-2].*)
329+
return 1
330+
;;
331+
esac
332+
return 0
333+
}
334+
316335
os::log::info "Starting 'networking' extended tests"
317336
if [[ -n "${CONFIG_ROOT}" ]]; then
318337
KUBECONFIG="$(get-kubeconfig-from-root "${CONFIG_ROOT}")"
@@ -382,6 +401,12 @@ else
382401
# Ignore deployment errors for a given plugin to allow other plugins
383402
# to be tested.
384403
test-osdn-plugin "subnet" "redhat/openshift-ovs-subnet" "false" "false" || true
404+
405+
if kernel-supports-networkpolicy; then
406+
test-osdn-plugin "networkpolicy" "redhat/openshift-ovs-networkpolicy" "false" "buggy" || true
407+
else
408+
os::log::warning "Skipping networkpolicy tests due to kernel version"
409+
fi
385410
fi
386411

387412
test-osdn-plugin "multitenant" "redhat/openshift-ovs-multitenant" "true" "false" || true

0 commit comments

Comments
 (0)