From 6eb670097c61833d400e851bc8add6e99bae5899 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 14 Oct 2015 19:47:42 -0400 Subject: [PATCH] Expand testing done via Travis CI to cover production pipeline. With this change, we are now testing the production static asset pipeline and installation process in a new testing job (and also run the frontend/backend tests separately). This means that changes that break the Zulip static asset pipeline or production installation process are more likely to fail tests. The testing is imperfect in that it does not have proper isolation -- we build a complete Zulip development environment and then install a Zulip production environment on top of it, so e.g. any apt dependencies installed for Zulip development will still be available for the Zulip production environment. But, it's better than nothing! A good v2 of this would be to have the production setup process just install the minimum stuff needed to run `build-release-tarball` and then uninstall it / clean it up so that we can do a more clear production installation, but that's more work. --- .travis.yml | 9 ++++++--- scripts/lib/install | 2 +- tools/travis/backend | 7 +++++++ tools/travis/frontend | 7 +++++++ tools/travis/production | 5 +++++ tools/travis/production-helper | 25 +++++++++++++++++++++++++ tools/travis/setup-backend | 5 +++++ tools/travis/setup-frontend | 1 + tools/travis/setup-production | 25 +++++++++++++++++++++++++ 9 files changed, 82 insertions(+), 4 deletions(-) create mode 100755 tools/travis/backend create mode 100755 tools/travis/frontend create mode 100755 tools/travis/production create mode 100755 tools/travis/production-helper create mode 100755 tools/travis/setup-backend create mode 120000 tools/travis/setup-frontend create mode 100755 tools/travis/setup-production diff --git a/.travis.yml b/.travis.yml index 428070a66a..c25c1e97bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,17 @@ install: - - pip install pbs - - python provision.py --travis + - tools/travis/setup-$TEST_SUITE cache: - apt: false +env: + - TEST_SUITE=frontend + - TEST_SUITE=backend + - TEST_SUITE=production language: python python: - "2.7" # command to run tests script: - - source /srv/zulip-venv/bin/activate && env PATH=$PATH:/srv/zulip-venv/bin ./tools/test-all + - ./tools/travis/$TEST_SUITE sudo: required services: - docker diff --git a/scripts/lib/install b/scripts/lib/install index f40bf676ce..3c6e3a7e76 100755 --- a/scripts/lib/install +++ b/scripts/lib/install @@ -11,7 +11,7 @@ deb-src http://ppa.launchpad.net/tabbott/zulip/ubuntu trusty main EOF apt-get update -apt-get -y dist-upgrade +apt-get -y dist-upgrade $APT_OPTIONS apt-get install -y puppet git python mkdir -p /etc/zulip diff --git a/tools/travis/backend b/tools/travis/backend new file mode 100755 index 0000000000..e1b3d206f9 --- /dev/null +++ b/tools/travis/backend @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +set -x +source /srv/zulip-venv/bin/activate +export PATH=$PATH:/srv/zulip-venv/bin +./tools/lint-all +./tools/test-backend diff --git a/tools/travis/frontend b/tools/travis/frontend new file mode 100755 index 0000000000..e661cdc4eb --- /dev/null +++ b/tools/travis/frontend @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +set -x +source /srv/zulip-venv/bin/activate +export PATH=$PATH:/srv/zulip-venv/bin +./tools/test-js-with-node +./tools/test-js-with-casper diff --git a/tools/travis/production b/tools/travis/production new file mode 100755 index 0000000000..506bb5e3ce --- /dev/null +++ b/tools/travis/production @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +set -x + +sudo ./tools/travis/production-helper diff --git a/tools/travis/production-helper b/tools/travis/production-helper new file mode 100755 index 0000000000..4ac3852449 --- /dev/null +++ b/tools/travis/production-helper @@ -0,0 +1,25 @@ +#!/bin/bash +set -e +set -x + +apt-get install openssl ssl-cert +ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/zulip.combined-chain.crt +ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/zulip.key + +tar -xf zulip-server-travis.tar.gz +mv zulip-server-travis /root/zulip + +export APT_OPTIONS="-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold" +/root/zulip/scripts/setup/install + +cat >>/etc/zulip/settings.py <