view .travis.yml @ 6565:2c2dbfc332ba

Try to handle multiple connections better. The session database is a hot spot. When multiple requests (e.g. 20) come in at the same time session database contention can get great. The original code didn't retry session database access when the open failed. This resulted in errors at the client. The second pass delayed 0.01 seconds and retried. It was better but we still had multiple second stalls. I think the first request got in, everybody else backed up and then retried at the same time. Again they stepped on each other. With logging I would see many counters go all the way to low single digits or to -1 indicating falure. This pass uses randomint to generate delays from 0-.125 seconds in 5ms increments. This performs better in testing. I rarely saw a counter less than 13 (2 failed retries). Current logging starts after 6 failures and counts down until success or failure.
author John Rouillard <rouilj@ieee.org>
date Thu, 16 Dec 2021 20:02:00 -0500
parents ae670ab2dd55
children f3a0cb617ea8
line wrap: on
line source

# check syntax using:
# https://config.travis-ci.com/explore

os: linux

language: python

cache: pip

#I would like to build and test the maint-1.6 and trunk/default
#but we need different environments for these:
#  maint-1.6 only python 2, install only psycopg2 version with support for
#     psycopg1 
branches:
#  only:
#    - default
#    - maint-1.6

dist:
  - bionic

#  - pypy3
python:
  - 2.7
  - 3.10.0
  - 3.9
  - 3.8
  - 3.6
  - nightly

services:
  - mysql
  - postgresql

jobs:
    allow_failures:  # nightly not ready for prime time yet.
      - python: 3.10
      - python: nightly
      - python: pypy3

addons:
  apt:
    sources:
      - sourceline: ppa:xapian-backports/ppa

    packages:
      # Required to build/install the xapian-binding
      - libxapian-dev
      # Required to install gpg
      - swig
      # Required to build gpgme.
      - gpgsm

before_install:
  # Sphinx required to build the xapian python bindings
  - pip install sphinx==1.8.5
  - XAPIAN_VER=$(dpkg -l libxapian-dev | tail -n 1 | awk '{print $3}' | cut -d '-' -f 1)
  - cd /tmp
  - curl -s -O https://oligarchy.co.uk/xapian/$XAPIAN_VER/xapian-bindings-$XAPIAN_VER.tar.xz
  - tar -Jxvf xapian-bindings-$XAPIAN_VER.tar.xz
  - cd xapian-bindings-$XAPIAN_VER/
  - echo $TRAVIS_PYTHON_VERSION
  - if [[ $TRAVIS_PYTHON_VERSION == "2."* ]]; then ./configure --prefix=$VIRTUAL_ENV --with-python; fi
  - if [[ $TRAVIS_PYTHON_VERSION == "3."* ]]; then ./configure --prefix=$VIRTUAL_ENV --with-python3; fi
  - if [[ $TRAVIS_PYTHON_VERSION == "nightly" ]]; then ./configure --prefix=$VIRTUAL_ENV --with-python3; fi
  - if [[ $TRAVIS_PYTHON_VERSION == "pypy3" ]]; then ./configure --prefix=$VIRTUAL_ENV --with-python3; fi
  - make && make install

  - PATH=$VIRTUAL_ENV/bin:$PATH

  # libgpg-error
  - LIBGPG_ERROR_VERSION=1.43
  - cd /tmp
  - curl -s -O https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2
  - tar -jxvf libgpg-error-$LIBGPG_ERROR_VERSION.tar.bz2
  - cd libgpg-error-$LIBGPG_ERROR_VERSION
  - ./configure --prefix=$VIRTUAL_ENV
  - make && make install

  # libassuan
  - LIBASSUAN_VERSION=2.5.5
  - cd /tmp
  - curl -s -O https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-$LIBASSUAN_VERSION.tar.bz2
  - tar -jxvf libassuan-$LIBASSUAN_VERSION.tar.bz2
  - cd libassuan-$LIBASSUAN_VERSION
  - ./configure --prefix=$VIRTUAL_ENV
  - make && make install

  # gpgme
  - GPGME_VERSION=1.16.0
  - cd /tmp
  - curl -s -O https://www.gnupg.org/ftp/gcrypt/gpgme/gpgme-$GPGME_VERSION.tar.bz2
  - tar -jxf gpgme-$GPGME_VERSION.tar.bz2
  - cd gpgme-$GPGME_VERSION
  - ./configure --prefix=$VIRTUAL_ENV
  - make && make install

  # change back to the checked out repository directory
  - cd $TRAVIS_BUILD_DIR

install:
  - if [[ $TRAVIS_PYTHON_VERSION == "3.4"* ]]; then  pip install mysqlclient==1.3.14; fi
  - if [[ $TRAVIS_PYTHON_VERSION != "3.4"* ]]; then pip install mysqlclient; fi
  - pip install psycopg2
  - pip install gpg pytz whoosh pyjwt requests
  - pip install pytest-cov codecov
  - if [[ $TRAVIS_PYTHON_VERSION != "3.4"* ]]; then pip install docutils; fi
  - if [[ $TRAVIS_PYTHON_VERSION != "3.4"* ]]; then pip install mistune; fi
  - if [[ $TRAVIS_PYTHON_VERSION != "3.4"* && $TRAVIS_PYTHON_VERSION != "2."* ]]; then pip install Markdown; fi
  - pip install markdown2
  - pip install brotli zstd

before_script:
  # set up mysql database
  - sudo sed -i -e '/^\[mysqld\]/,/^\[mysql/s/^max_allowed_packet.*/max_allowed_packet = 500M/' /etc/mysql/my.cnf
  - cat /etc/mysql/my.cnf
  - sudo service mysql restart
  - mysql -u root -e 'GRANT ALL ON rounduptest.* TO rounduptest@localhost IDENTIFIED BY "rounduptest";'

  - sudo service postgresql restart; sleep 30
  # set up postgresql database
  - psql -c "CREATE ROLE rounduptest WITH CREATEDB LOGIN PASSWORD 'rounduptest';" -U postgres

  # HACK: workaround mysql bug: http://bugs.mysql.com/bug.php?id=74901
  #   needed for test_mysql.mysqlDBTest.testFilteringSpecialChars
  - sed -i 's/CREATE DATABASE \%s/CREATE DATABASE \%s COLLATE utf8_general_ci/' roundup/backends/back_mysql.py

  # build the .mo translation files and install them into a tree
  # (locale/locale under roundup directory root) 
  # suitable for use by gettext.
  - (cd locale; make local_install; ls -lR locale/de/LC_MESSAGES)

script:
  - PATH=$VIRTUAL_ENV/bin:$PATH
  - export LD_LIBRARY_PATH=$VIRTUAL_ENV/lib:$LD_LIBRARY_PATH
  - if [[ "$TRAVIS_PYTHON_VERSION" != "2."* ]]; then
    py.test 
      -W default
      -W "ignore:SelectableGroups:DeprecationWarning" 
      -W "ignore:the imp module:DeprecationWarning:gpg.gpgme:15" 
      -W "ignore:'U' mode::docutils.io" 
      -W "ignore:unclosed:ResourceWarning:roundup.roundup.demo" 
      -W "ignore:unclosed file:ResourceWarning:enum" 
      -v --maxfail=20 test/ --cov=roundup;
    fi
  - if [[ "$TRAVIS_PYTHON_VERSION" == "2."* ]]; then
      py.test -v --maxfail=20 test/ --cov=roundup;
    fi

after_success:
  - codecov

Roundup Issue Tracker: http://roundup-tracker.org/