CI: Add netns to test
Sample run:
```
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Test
:: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ 15:37:14 ] :: [ LOG ] :: ip netns tests
:: [ 15:37:14 ] :: [ LOG ] :: ip netns tests
:: [ 15:37:14 ] :: [ BEGIN ] :: Running '/usr/bin/python3 /usr/bin/ip-netns-tests.py'
test_add_dummy_interface_to_ns (__main__.IPNsTests) ... 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/gre 0.0.0.0 brd 0.0.0.0
3: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1446 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1446 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/tunnel6 :: brd ::
6: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/gre6 :: brd ::
7: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
8: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
9: ip_vti0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
143: dummy-test: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 6e:d1:ba:73:59:c5 brd ff:ff:ff:ff:ff:ff
ok
test_add_ns (__main__.IPNsTests) ... ok
test_add_veth_interface_to_ns (__main__.IPNsTests) ... 1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/gre 0.0.0.0 brd 0.0.0.0
3: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1446 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/tunnel6 :: brd ::
6: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/gre6 :: brd ::
7: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
8: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
9: ip_vti0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
144: test-peer@if145: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 62:ce:d1:9f:bc:de brd ff:ff:ff:ff:ff:ff link-netnsid 0
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: gre0@NONE: <NOARP> mtu 1476 qdisc noop state DOWN group default qlen 1000
link/gre 0.0.0.0 brd 0.0.0.0
3: gretap0@NONE: <BROADCAST,MULTICAST> mtu 1462 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: erspan0@NONE: <BROADCAST,MULTICAST> mtu 1446 qdisc noop state DOWN group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
5: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1000
link/tunnel6 :: brd ::
6: ip6gre0@NONE: <NOARP> mtu 1448 qdisc noop state DOWN group default qlen 1000
link/gre6 :: brd ::
7: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
8: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
9: ip_vti0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
144: test-peer@if145: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 62:ce:d1:9f:bc:de brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.200.1.2/24 scope global test-peer
valid_lft forever preferred_lft forever
inet6 fe80::60ce:d1ff:fe9f:bcde/64 scope link tentative
valid_lft forever preferred_lft forever
PING 10.200.1.1 (10.200.1.1) 56(84) bytes of data.
64 bytes from 10.200.1.1: icmp_seq=1 ttl=64 time=0.063 ms
64 bytes from 10.200.1.1: icmp_seq=2 ttl=64 time=0.042 ms
64 bytes from 10.200.1.1: icmp_seq=3 ttl=64 time=0.054 ms
64 bytes from 10.200.1.1: icmp_seq=4 ttl=64 time=0.059 ms
64 bytes from 10.200.1.1: icmp_seq=5 ttl=64 time=0.064 ms
--- 10.200.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4073ms
rtt min/avg/max/mdev = 0.042/0.056/0.064/0.010 ms
ok
----------------------------------------------------------------------
Ran 3 tests in 4.431s
Ran 3 tests in 4.431s
OK
:: [ 15:37:18 ] :: [ PASS ] :: Command '/usr/bin/python3 /usr/bin/ip-netns-tests.py' (Expected 0, got 0)
:: [ 15:37:18 ] :: [ PASS ] :: Command '/usr/bin/python3 /usr/bin/ip-netns-tests.py' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Duration: 4s
:: Duration: 4s
:: Assertions: 1 good, 0 bad
:: Assertions: 1 good, 0 bad
:: RESULT: PASS
:: RESULT: PASS
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Cleanup
:: Cleanup
```
2018-07-31 10:06:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
|
|
|
# ~~~
|
|
|
|
# runtest.sh of /CoreOS/iproute/Sanity/ip-netns-sanity-test
|
|
|
|
# Description: Test basic ip netns funcionality
|
|
|
|
#
|
|
|
|
# Author: Susant Sahani <susant@redhat.com>
|
|
|
|
# Copyright (c) 2018 Red Hat, Inc.
|
|
|
|
#~~~
|
|
|
|
|
|
|
|
export TEST=/CoreOS/iproute/Sanity/ip-ns-sanity-test
|
|
|
|
export TESTVERSION=1.0
|
|
|
|
|
|
|
|
BUILT_FILES=
|
|
|
|
|
|
|
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
|
|
|
|
|
|
|
.PHONY: all install download clean
|
|
|
|
|
|
|
|
run: $(FILES) build
|
|
|
|
./runtest.sh
|
|
|
|
|
|
|
|
build: $(BUILT_FILES)
|
|
|
|
test -x runtest.sh || chmod a+x runtest.sh
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *~ $(BUILT_FILES)
|
|
|
|
|
|
|
|
|
|
|
|
include /usr/share/rhts/lib/rhts-make.include
|
|
|
|
|
|
|
|
$(METADATA): Makefile
|
|
|
|
@echo "Owner: Susant Sahani <susant@redhat.com>" > $(METADATA)
|
|
|
|
@echo "Name: $(TEST)" >> $(METADATA)
|
|
|
|
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
|
|
|
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
|
|
|
@echo "Description: Test basic ip netns funcionality" >> $(METADATA)
|
|
|
|
@echo "Type: Sanity" >> $(METADATA)
|
|
|
|
@echo "TestTime: 15m" >> $(METADATA)
|
|
|
|
@echo "RunFor: iproute" >> $(METADATA)
|
|
|
|
@echo "Requires: iproute" >> $(METADATA)
|
|
|
|
@echo "Priority: Normal" >> $(METADATA)
|
|
|
|
@echo "License: GPLv2" >> $(METADATA)
|
|
|
|
@echo "Confidential: no" >> $(METADATA)
|
|
|
|
@echo "Destructive: no" >> $(METADATA)
|
|
|
|
|
|
|
|
rhts-lint $(METADATA)
|