From 3d3242cccf839eff20922323d539a895122e2d5b Mon Sep 17 00:00:00 2001 From: Mark Stumpf Date: Mon, 18 Sep 2017 15:36:33 -0400 Subject: [PATCH 1/4] add support for circleci testing for haproxy --- .circleci/config.yml | 32 ++++++++++++++++++++++++++++++++ test_requirements.txt | 3 +++ verify.sh | 6 ++++++ 3 files changed, 41 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 test_requirements.txt create mode 100755 verify.sh diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..3b7d708 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,32 @@ +version: 2 +jobs: + build: + docker: + - ubuntu:yakkety + working_directory: ~/code + steps: + - setup_remote_docker + - run: + name: Install Docker client + command: | + set -x + VER="17.03.0-ce" + apt-get update -q + apt-get install -yq curl python-pip + curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz + tar -xz -C /tmp -f /tmp/docker-$VER.tgz + mv /tmp/docker/* /usr/bin + - run: + name: Install docker-compose + command: | + set -x + curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose + - checkout + # run tests + - run: + name: run basic tests + working_directory: ~/code + command: | + pip install -r test_requirements.txt + bash verify.sh diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 0000000..3f37b24 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,3 @@ +pep8 +pytest +mock diff --git a/verify.sh b/verify.sh new file mode 100755 index 0000000..7f9937d --- /dev/null +++ b/verify.sh @@ -0,0 +1,6 @@ +#!/bin/bash +pep8 --max-line-length=120 haproxy.py +if [ "$?" -ne 0 ]; then + exit 1; +fi +py.test test_haproxy.py From e78bd524c16e62fddf5145954871cac9baa16246 Mon Sep 17 00:00:00 2001 From: Mark Stumpf Date: Mon, 18 Sep 2017 15:45:43 -0400 Subject: [PATCH 2/4] update haproxy circleci config --- .circleci/config.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b7d708..c607b87 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - ubuntu:yakkety + - image: ubuntu:yakkety working_directory: ~/code steps: - setup_remote_docker @@ -23,9 +23,8 @@ jobs: curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose - checkout - # run tests - run: - name: run basic tests + name: Run basic tests working_directory: ~/code command: | pip install -r test_requirements.txt From 582ee5d63e9eb79b628933c20dcd697a5ec25012 Mon Sep 17 00:00:00 2001 From: Mark Stumpf Date: Mon, 18 Sep 2017 16:32:53 -0400 Subject: [PATCH 3/4] fix typo in circleci config --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c607b87..30aa288 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2 +version: '2' jobs: build: docker: From 64d34a942dc70ffac24eea3fdf2ec0f1e0c1c781 Mon Sep 17 00:00:00 2001 From: Mark Stumpf Date: Tue, 19 Sep 2017 09:28:39 -0400 Subject: [PATCH 4/4] update verify.sh to fail using set -e instead of if statement --- verify.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/verify.sh b/verify.sh index 7f9937d..1cdb22d 100755 --- a/verify.sh +++ b/verify.sh @@ -1,6 +1,4 @@ #!/bin/bash +set -e pep8 --max-line-length=120 haproxy.py -if [ "$?" -ne 0 ]; then - exit 1; -fi py.test test_haproxy.py