Skip to content

Commit

Permalink
Merge pull request #2326 from gizmoguy/fixup-deps
Browse files Browse the repository at this point in the history
Fix up our apt package dependencies
  • Loading branch information
anarkiwi committed Aug 23, 2018
2 parents 93f10f1 + e82e64d commit 64692ae
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 3 deletions.
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ Depends: python3-oslo.config (>= 1:3.9~),
python3-pbr (>= 1.9),
python3-prometheus-client (>= 0.0.18),
python3-yaml (>= 3.1.1),
python3-eventlet,
python3-ryu (>= 4.22),
python3-beka (>= 0.3.3),
python3-chewie (>= 0.0.2),
python3-pytricia (>= 1.0.0),
python3:any (>= 3.4~),
Suggests: python-faucet-doc, faucet, gauge, oslo.config,
Description: source code for faucet and gauge (Python3)
Expand Down Expand Up @@ -69,7 +71,7 @@ Description: This is a component the Faucet OpenFlow controller (Python 3)
.
This package installs the library for Python 3.

package: faucet-all-in-one
Package: faucet-all-in-one
Architecture: all
Depends: faucet (>= 1.7.0),
gauge (>= 1.7.0),
Expand Down
2 changes: 1 addition & 1 deletion docker/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ locale-gen en_US.UTF-8 || exit 1
if [ "$UNITTESTS" == 1 ] ; then
echo "========== Running faucet unit tests =========="
cd /faucet-src/tests
./run_unit_tests.sh || exit 1
LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8 ./run_unit_tests.sh || exit 1
fi

if [ "$DEPCHECK" == 1 ] ; then
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ chewie==0.0.2
datadiff
eventlet==0.22.1 # pyup: ignore
influxdb
ipaddress
msgpack
msgpack-python
networkx
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
bitstring
codecov
concurrencytest
deb_pkg_tools
eventlet==0.22.1 # pyup: ignore
exabgp
influxdb
Expand Down
67 changes: 67 additions & 0 deletions tests/unit/packaging/test_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env python

"""Test FAUCET packaging"""

# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest
import pip.req

from deb_pkg_tools.control import deb822_from_string, parse_control_fields

class CheckRequirementsTestCase(unittest.TestCase): # pytype: disable=module-attr
"""Test packaging requirements."""

def test_requirements_match(self):
"""Test all requirements are listed as apt package dependencies."""

SRC_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
control_file = os.path.join(SRC_DIR, 'debian/control')
requirements_file = os.path.join(SRC_DIR, 'requirements.txt')

real_name = {
'msgpack-python': 'python3-msgpack',
'pyyaml': 'python3-yaml'
}

with open(control_file) as handle:
control = handle.read()

faucet_dpkg = str()
for line in control.split("\n"):
if line.startswith("Package: python3-faucet"):
faucet_dpkg += line
elif len(faucet_dpkg) > 0:
if not line:
break
faucet_dpkg += "{}\n".format(line)

faucet_dpkg = parse_control_fields(deb822_from_string(faucet_dpkg))
faucet_dpkg_deps = [x.name for x in faucet_dpkg['Depends']]

for item in pip.req.parse_requirements(requirements_file,
session="unittest"):
if isinstance(item, pip.req.InstallRequirement):
if item.name in real_name:
self.assertIn(real_name[item.name], faucet_dpkg_deps)
else:
self.assertIn("python3-{}".format(item.name), faucet_dpkg_deps)


if __name__ == "__main__":
unittest.main() # pytype: disable=module-attr
32 changes: 32 additions & 0 deletions travis/run-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

if [ "${MATRIX_SHARD}" = "sanity" ] ; then
FAUCET_TESTS="-u FaucetSanityTest"
./tests/run_unit_tests.sh || exit 1
codecov || true
else
ALLTESTFILES="tests/integration/mininet_tests.py clib/clib_mininet_tests.py"
ALLTESTS=`grep -E -o "^class (Faucet[a-zA-Z0-9]+Test)" ${ALLTESTFILES}|cut -f2 -d" "|sort`
declare -A sharded

function shard {
work=$1
workers=$2
i=0
for shard in $work ; do
i=$(expr $i % $workers)
sharded[$i]="${sharded[$i]} $shard"
i=$(expr $i + 1)
done
}

shard "$ALLTESTS" ${MATRIX_SHARDS}
FAUCET_TESTS="-i ${sharded[${MATRIX_SHARD}]}"
fi

echo Shard $MATRIX_SHARD: $FAUCETTESTS
sudo docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 \
-v $HOME/.cache/pip:/var/tmp/pip-cache \
-e FAUCET_TESTS="${FAUCET_TESTS}" \
-t ${FAUCET_TEST_IMG} || exit 1
exit 0

0 comments on commit 64692ae

Please sign in to comment.