Skip to content

Commit

Permalink
Issues: Install test does not test validity of packages (rpm/deb)
Browse files Browse the repository at this point in the history
Fixes F5Networks#494

Problem:
The test install algorithm to work with a more generic pool

Analysis:
I made the changes to make it so that the .deb and .rpm install tests
would do what they're supposed to do.  Before this change, the .deb and
.rpm failures were not being properly tracked and would always fail due
to improper regExp handling of expected strings.

Tests:
This is a test.  To validate that this executes properly, use the
.travis_yml file in its normal execution phasing.
  • Loading branch information
sorensF5 committed Jan 24, 2017
1 parent 3660512 commit 8820480
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ before_install:

install:
- pip install tox
- pip install ordereddict
- pip install six
script:
- tox -e style,unit
- f5-openstack-agent-dist/scripts/package_agent.sh "redhat" "7"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dockerfile
FROM ubuntu:trusty
COPY ./fetch_and_install_deps.py /

RUN apt-get update -y && apt-get install software-properties-common -y
RUN apt-add-repository cloud-archive:liberty
Expand All @@ -8,6 +9,9 @@ RUN apt-add-repository cloud-archive:mitaka
RUN apt-get update -y
RUN apt-get install python-requests git curl -y --force-yes
RUN apt-get install python-six
RUN chmod 700 /fetch_and_install_deps.py

COPY ./fetch_and_install_deps.py /
ENTRYPOINT ["/fetch_and_install_deps.py", "/var/wdir"]
# The following is the default, last arg if you ran the docker container on its own...
CMD ["/var/wdir/f5-openstack-agent/deb_dist/python-f5-openstack-agent_*_1404_all.deb"]

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

from collections import deque, namedtuple

f5_sdk_rest_pattern = re.compile("^f5-sdk\s*=\s*(\d+\.\d+\.\d+)$")
f5_sdk_rest_pattern = re.compile(
"^f5-sdk-rest\s*=\s*(\d+\.\d+\.\d+)$")
dep_match_re = re.compile('^\s*([\w\-]+)\s\(([=<>]+)\s([^\)]+)')


def usage():
print "fetch_dependencies.py working_dir"
print sys.argv
print "fetch_dependencies.py working_dir pkg.deb"



def runCommand(cmd):
Expand Down
32 changes: 29 additions & 3 deletions f5-openstack-agent-dist/scripts/test_install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#!/bin/bash -ex

OS_TYPE=$1

# We should have at least an argument $1...
if [ ${OS_TYPE} == "--help" ] || [ ${OS_TYPE} == "-h" ] || \
[ "${OS_TYPE}" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then
echo "Standard Usage:
$0 <os type> <os version> <./path/to/package>
Debug Usage:
$0 <os type> <os version> <./path/to/package> --debug
Optional --debug operation:
The results from the test python script will pipe into:
/tmp/test_install.o"
exit 1
fi

OS_VERSION=$2
PKG_FULLNAME=$3
if [ '--debug' == "$4" ]; then
DEBUG=1
else
DEBUG=0
fi
PKG_NAME="f5-openstack-agent"
DIST_DIR="${PKG_NAME}-dist"

Expand All @@ -27,7 +46,14 @@ DOCKER_DIR="${DIST_DIR}/Docker/${OS_TYPE}/install_test"
DOCKER_FILE="${DOCKER_DIR}/Dockerfile.${CONTAINER_TYPE}"

docker build -t ${BUILD_CONTAINER} -f ${DOCKER_FILE} ${DOCKER_DIR}
docker run --privileged --rm -v $(pwd):${WORKING_DIR} ${BUILD_CONTAINER} /usr/bin/python \
/fetch_and_install_deps.py ${WORKING_DIR} ${PKG_FULLNAME}
if [ ${DEBUG} == 0 ]; then
docker run --privileged --rm -v $(pwd):${WORKING_DIR} ${BUILD_CONTAINER} \
${PKG_FULLNAME}
else
docker run --privileged --rm -v $(pwd):${WORKING_DIR} ${BUILD_CONTAINER} \
${PKG_FULLNAME} > /tmp/test_instal.o
fi
# NOTE: contrary to documentation, the '-d' flag is not required, and
# ${PKG_FULLNAME} is passed.

exit 0
exit $?

0 comments on commit 8820480

Please sign in to comment.