Skip to content

Commit 64692ae

Browse files
authored
Merge pull request #2326 from gizmoguy/fixup-deps
Fix up our apt package dependencies
2 parents 93f10f1 + e82e64d commit 64692ae

File tree

6 files changed

+104
-3
lines changed

6 files changed

+104
-3
lines changed

debian/control

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ Depends: python3-oslo.config (>= 1:3.9~),
2626
python3-pbr (>= 1.9),
2727
python3-prometheus-client (>= 0.0.18),
2828
python3-yaml (>= 3.1.1),
29+
python3-eventlet,
2930
python3-ryu (>= 4.22),
3031
python3-beka (>= 0.3.3),
3132
python3-chewie (>= 0.0.2),
33+
python3-pytricia (>= 1.0.0),
3234
python3:any (>= 3.4~),
3335
Suggests: python-faucet-doc, faucet, gauge, oslo.config,
3436
Description: source code for faucet and gauge (Python3)
@@ -69,7 +71,7 @@ Description: This is a component the Faucet OpenFlow controller (Python 3)
6971
.
7072
This package installs the library for Python 3.
7173

72-
package: faucet-all-in-one
74+
Package: faucet-all-in-one
7375
Architecture: all
7476
Depends: faucet (>= 1.7.0),
7577
gauge (>= 1.7.0),

docker/runtests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ locale-gen en_US.UTF-8 || exit 1
5757
if [ "$UNITTESTS" == 1 ] ; then
5858
echo "========== Running faucet unit tests =========="
5959
cd /faucet-src/tests
60-
./run_unit_tests.sh || exit 1
60+
LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8 ./run_unit_tests.sh || exit 1
6161
fi
6262

6363
if [ "$DEPCHECK" == 1 ] ; then

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ chewie==0.0.2
22
datadiff
33
eventlet==0.22.1 # pyup: ignore
44
influxdb
5-
ipaddress
65
msgpack
76
msgpack-python
87
networkx

test-requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
bitstring
22
codecov
33
concurrencytest
4+
deb_pkg_tools
45
eventlet==0.22.1 # pyup: ignore
56
exabgp
67
influxdb
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python
2+
3+
"""Test FAUCET packaging"""
4+
5+
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
6+
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
7+
# Copyright (C) 2015--2018 The Contributors
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License");
10+
# you may not use this file except in compliance with the License.
11+
# You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS,
17+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# See the License for the specific language governing permissions and
19+
# limitations under the License.
20+
21+
import os
22+
import unittest
23+
import pip.req
24+
25+
from deb_pkg_tools.control import deb822_from_string, parse_control_fields
26+
27+
class CheckRequirementsTestCase(unittest.TestCase): # pytype: disable=module-attr
28+
"""Test packaging requirements."""
29+
30+
def test_requirements_match(self):
31+
"""Test all requirements are listed as apt package dependencies."""
32+
33+
SRC_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
34+
control_file = os.path.join(SRC_DIR, 'debian/control')
35+
requirements_file = os.path.join(SRC_DIR, 'requirements.txt')
36+
37+
real_name = {
38+
'msgpack-python': 'python3-msgpack',
39+
'pyyaml': 'python3-yaml'
40+
}
41+
42+
with open(control_file) as handle:
43+
control = handle.read()
44+
45+
faucet_dpkg = str()
46+
for line in control.split("\n"):
47+
if line.startswith("Package: python3-faucet"):
48+
faucet_dpkg += line
49+
elif len(faucet_dpkg) > 0:
50+
if not line:
51+
break
52+
faucet_dpkg += "{}\n".format(line)
53+
54+
faucet_dpkg = parse_control_fields(deb822_from_string(faucet_dpkg))
55+
faucet_dpkg_deps = [x.name for x in faucet_dpkg['Depends']]
56+
57+
for item in pip.req.parse_requirements(requirements_file,
58+
session="unittest"):
59+
if isinstance(item, pip.req.InstallRequirement):
60+
if item.name in real_name:
61+
self.assertIn(real_name[item.name], faucet_dpkg_deps)
62+
else:
63+
self.assertIn("python3-{}".format(item.name), faucet_dpkg_deps)
64+
65+
66+
if __name__ == "__main__":
67+
unittest.main() # pytype: disable=module-attr

travis/run-integration-tests.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
if [ "${MATRIX_SHARD}" = "sanity" ] ; then
4+
FAUCET_TESTS="-u FaucetSanityTest"
5+
./tests/run_unit_tests.sh || exit 1
6+
codecov || true
7+
else
8+
ALLTESTFILES="tests/integration/mininet_tests.py clib/clib_mininet_tests.py"
9+
ALLTESTS=`grep -E -o "^class (Faucet[a-zA-Z0-9]+Test)" ${ALLTESTFILES}|cut -f2 -d" "|sort`
10+
declare -A sharded
11+
12+
function shard {
13+
work=$1
14+
workers=$2
15+
i=0
16+
for shard in $work ; do
17+
i=$(expr $i % $workers)
18+
sharded[$i]="${sharded[$i]} $shard"
19+
i=$(expr $i + 1)
20+
done
21+
}
22+
23+
shard "$ALLTESTS" ${MATRIX_SHARDS}
24+
FAUCET_TESTS="-i ${sharded[${MATRIX_SHARD}]}"
25+
fi
26+
27+
echo Shard $MATRIX_SHARD: $FAUCETTESTS
28+
sudo docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 \
29+
-v $HOME/.cache/pip:/var/tmp/pip-cache \
30+
-e FAUCET_TESTS="${FAUCET_TESTS}" \
31+
-t ${FAUCET_TEST_IMG} || exit 1
32+
exit 0

0 commit comments

Comments
 (0)