From c3d9f5778188711fd069fddbb1549ddfc9ef6e87 Mon Sep 17 00:00:00 2001 From: Johan Guldmyr Date: Thu, 5 Jan 2017 12:14:33 +0200 Subject: [PATCH] testing: cleanup and speedup --- .travis.yml | 44 --------------------------------- tests/devel-centos7/Dockerfile | 2 +- tests/epel-centos7/Dockerfile | 2 +- tests/stable-centos7/Dockerfile | 2 +- tests/test-in-docker-image.sh | 2 +- 5 files changed, 4 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4eff7ab..83c075d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,61 +34,17 @@ script: - docker run --privileged -d -ti -e "container=docker" -v `pwd`:/$ROLETOTEST -v /sys/fs/cgroup:/sys/fs/cgroup ${REPO}:${IMAGE_BUILD_PLATFORM} /usr/sbin/init - DOCKER_CONTAINER_ID=$(docker ps | grep ${IMAGE_BUILD_PLATFORM} | awk '{print $1}') - docker logs $DOCKER_CONTAINER_ID -# Prepare test environment and print some more debug out - - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'sudo yum -y install make && mkdir -p /opt/ansible/' - - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'if ! [ -d /opt/ansible/ansible ] || ! bash -c "cd /opt/ansible/ansible && git branch"; then git clone http://github.com/ansible/ansible.git /opt/ansible/ansible ; fi' - - > - export ANSIBLE_VERSION=$(docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'cd /opt/ansible/ansible && \ - ansible-playbook --version | perl -n -e '\''if ( m/^ansible-playbook\s+([0-9\.]{1,7})/ ) { print $1 }'\'' | tr -d "\n" \ - ') - - > - export GIT_COMMIT=$(docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'cd /opt/ansible/ansible && \ - ansible-playbook --version | perl -n -e '\''if ( m/^ansible-playbook\s+[0-9\.]{1,7}\s+.*?([a-fA-F0-9]{7,40})/ ) { print $1 }'\'' | tr -d "\n" \ - ') - - > - export GIT_TAG=$(docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c "cd /opt/ansible/ansible && \ - git tag | grep $ANSIBLE_VERSION | grep -v rc | tr -d '\n' \ - ") - - > - echo "Ansible Version: $ANSIBLE_VERSION" - - > - echo "git SHA: $GIT_COMMIT" - - > - echo "Tagged Release?: $GIT_TAG" - - > - echo "CHECKING OUT: ${GIT_COMMIT:-$GIT_TAG}" - - > - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c "cd /opt/ansible/ansible && - git checkout ${GIT_COMMIT:-$GIT_TAG} && git submodule update --init --recursive && - git --no-pager log --decorate=short --pretty=oneline -n 1" - - > - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'cd /opt/ansible/ansible && - sudo pip install tox sphinx && - sudo pip install paramiko PyYAML jinja2 httplib2 passlib nose mock ' # Testing of this ansible-role: - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c "/$ROLETOTEST/tests/test-in-docker-image.sh" -# - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'cd /opt/ansible/ansible && make tests ' -# - > -# docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'cd /opt/ansible/ansible/test/integration/ && -# make -j 1 parsing test_var_precedence test_templating_settings includes test_hash test_handlers test_group_by ' - > docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'echo -ne "------\nEND ANSIBLE TESTS\n------\nSystemD Units:\n------\n"; systemctl --no-pager --all --full status ; echo -ne "------\nJournalD Logs:\n------\n" ; sudo journalctl --catalog --all --full --no-pager' - - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'sudo yum -y install tree' - docker exec -ti $DOCKER_CONTAINER_ID /bin/sh -c 'tree /ansible*' - docker ps -a - docker stop $DOCKER_CONTAINER_ID - docker rm -v $DOCKER_CONTAINER_ID -#after_success: -# - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" -# - if [ "$TRAVIS_BRANCH" == "master" -a "$IMAGE_BUILD_PLATFORM" == "stable-centos7" ]; then docker tag ${REPO}:${IMAGE_BUILD_PLATFORM} $REPO:latest; fi -# - docker tag ${REPO}:${IMAGE_BUILD_PLATFORM} $REPO:travis-${TRAVIS_BUILD_NUMBER} -# - docker tag ${REPO}:${IMAGE_BUILD_PLATFORM} $REPO:${IMAGE_BUILD_PLATFORM}-${ANSIBLE_VERSION} -# - docker tag ${REPO}:${IMAGE_BUILD_PLATFORM} $REPO:${IMAGE_BUILD_PLATFORM}-${GIT_COMMIT:-$GIT_TAG} -# - docker push $REPO -# - "[ -e \"~/.docker/config.json\" ] && shred -n 30 -u -z ~/.docker/config.json" notifications: email: false diff --git a/tests/devel-centos7/Dockerfile b/tests/devel-centos7/Dockerfile index c08c704..6105435 100644 --- a/tests/devel-centos7/Dockerfile +++ b/tests/devel-centos7/Dockerfile @@ -21,7 +21,7 @@ RUN yum clean all && \ yum -y remove $(rpm -qa "*-devel") && \ yum -y groupremove "Development tools" && \ yum -y autoremove && \ - yum -y install bzip2 file findutils gem git gzip hg procps-ng svn sudo tar which unzip xz zip && \ + yum -y install bzip2 crontabs file findutils gem git gzip hg procps-ng svn sudo tar tree which unzip xz zip && \ yum clean all && rm -rf /var/cache/yum RUN mkdir /etc/ansible/ diff --git a/tests/epel-centos7/Dockerfile b/tests/epel-centos7/Dockerfile index 71eea6a..38801ff 100644 --- a/tests/epel-centos7/Dockerfile +++ b/tests/epel-centos7/Dockerfile @@ -12,7 +12,7 @@ RUN yum clean all && \ yum -y remove $(rpm -qa "*-devel") && \ yum -y groupremove "Development tools" && \ yum -y autoremove && \ - yum -y install bzip2 file findutils gem git gzip hg procps-ng svn sudo tar which unzip xz zip + yum -y install bzip2 crontabs file findutils gem git gzip hg procps-ng svn sudo tar tree which unzip xz zip RUN mkdir /etc/ansible/ RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts diff --git a/tests/stable-centos7/Dockerfile b/tests/stable-centos7/Dockerfile index ff8fc9f..8db5325 100644 --- a/tests/stable-centos7/Dockerfile +++ b/tests/stable-centos7/Dockerfile @@ -12,7 +12,7 @@ RUN yum clean all && \ yum -y remove $(rpm -qa "*-devel") && \ yum -y groupremove "Development tools" && \ yum -y autoremove && \ - yum -y install bzip2 file findutils gem git gzip hg procps-ng svn sudo tar which unzip xz zip + yum -y install bzip2 crontabs file findutils gem git gzip hg procps-ng svn sudo tar tree which unzip xz zip RUN mkdir /etc/ansible/ RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts diff --git a/tests/test-in-docker-image.sh b/tests/test-in-docker-image.sh index b46a793..36ec9b8 100755 --- a/tests/test-in-docker-image.sh +++ b/tests/test-in-docker-image.sh @@ -135,7 +135,7 @@ function extra_tests(){ set -e function main(){ - install_os_deps +# install_os_deps # install_ansible_devel show_version tree_list