-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2326 from gizmoguy/fixup-deps
Fix up our apt package dependencies
- Loading branch information
Showing
6 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |