diff --git a/.travis.yml b/.travis.yml index 60617b9dc1..7dd491accb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ # http://docs.travis-ci.com/user/workers/standard-infrastructure/ sudo: required # NOTE: We use precise because tests finish faster than on Xenial -dist: precise +dist: xenial language: python branches: @@ -32,10 +32,10 @@ matrix: # job which also includes "make requirements" and other steps # "make requirements" can take substantially lower if the cache is purged # and this would cause too many intermediate failures / false positives - - env: TASK=ci-unit CACHE_NAME=py2 COMMAND_THRESHOLD=700 + - env: TASK=ci-unit CACHE_NAME=py2 COMMAND_THRESHOLD=1400 python: 2.7 name: "Unit Tests (Python 2.7 MongoDB 3.4)" - #- env: TASK=ci-unit CACHE_NAME=py2 COMMAND_THRESHOLD=700 + #- env: TASK=ci-unit CACHE_NAME=py2 COMMAND_THRESHOLD=1400 #python: 2.7 #name: "Unit Tests (Python 2.7 MongoDB 3.6)" #addons: @@ -49,38 +49,40 @@ matrix: # - mongodb-org-server # - mongodb-org-shell # - git - - env: TASK=ci-integration CACHE_NAME=py2 COMMAND_THRESHOLD=700 + - env: TASK=ci-integration CACHE_NAME=py2 COMMAND_THRESHOLD=1400 python: 2.7 name: "Integration Tests (Python 2.7)" - - env: TASK="ci-checks ci-packs-tests" CACHE_NAME=py2 COMMAND_THRESHOLD=280 + - env: TASK="ci-checks ci-packs-tests" CACHE_NAME=py2 COMMAND_THRESHOLD=560 python: 2.7 name: "Lint Checks, Packs Tests (Python 2.7)" - - env: TASK="compilepy3 ci-py3-unit" CACHE_NAME=py3 COMMAND_THRESHOLD=680 + - env: TASK="compilepy3 ci-py3-unit" CACHE_NAME=py3 COMMAND_THRESHOLD=1360 python: 3.6 name: "Unit Tests, Pack Tests (Python 3.6)" - - env: TASK="ci-py3-integration" CACHE_NAME=py3 COMMAND_THRESHOLD=310 + - env: TASK="ci-py3-integration" CACHE_NAME=py3 COMMAND_THRESHOLD=620 python: 3.6 name: "Integration Tests (Python 3.6)" -addons: - apt: - sources: - - mongodb-upstart - - sourceline: 'deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse' - key_url: 'https://www.mongodb.org/static/pgp/server-3.4.asc' - # NOTE: Precise repo doesn't contain Erlang 20.x, latest version is 19.x so we need to use RabbitMQ 3.7.6 - #- sourceline: 'deb [arch=amd64] http://packages.erlang-solutions.com/ubuntu precise contrib' - # key_url: 'https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc' - #- sourceline: 'deb [arch=amd64] https://dl.bintray.com/rabbitmq/debian precise rabbitmq-server-v3.6.x' - # key_url: 'https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc' - - sourceline: 'ppa:git-core/ppa' - packages: - - mongodb-org-server - - mongodb-org-shell - - erlang - - rabbitmq-server - - git - - libffi-dev +# APT addon has been broken since 16.08.2019 and timing out on +# travis_apt_get_update step +#addons: +# apt: +# sources: +# - mongodb-upstart +# - sourceline: 'deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse' +# key_url: 'https://www.mongodb.org/static/pgp/server-3.4.asc' +# # NOTE: Precise repo doesn't contain Erlang 20.x, latest version is 19.x so we need to use RabbitMQ 3.7.6 +# #- sourceline: 'deb [arch=amd64] http://packages.erlang-solutions.com/ubuntu precise contrib' +# # key_url: 'https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc' +# #- sourceline: 'deb [arch=amd64] https://dl.bintray.com/rabbitmq/debian precise rabbitmq-server-v3.6.x' +# # key_url: 'https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc' +# - sourceline: 'ppa:git-core/ppa' +# packages: +# - mongodb-org-server +# - mongodb-org-shell +# - erlang +# - rabbitmq-server +# - git +# - libffi-dev cache: pip: true @@ -95,6 +97,22 @@ cache: #- .tox/ before_install: + # Add MongoDB and git apt repos + - sudo apt-get install -y apt-transport-https + # NOTE: xenial already ships with git version which is recent enough for content_version functionality + # - sudo add-apt-repository -y ppa:git-core/ppa + # - sudo apt-get install -y git + - curl https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add - + - echo "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee -a /etc/apt/sources.list + # Work around for Travis timeout issues and apt-get getting stuck on waiting for headers, see: + # https://github.com/travis-ci/travis-ci/issues/9112 + - sudo apt-get clean + - sudo mv /var/lib/apt/lists /var/lib/apt/lists.old + - sudo mkdir -p /var/lib/apt/lists/partial + - sudo apt-get clean + - sudo apt-get update --option Acquire::ForceIPv4=true --option Acquire::Retries=100 --option Acquire::http::Timeout="60" + # Install MongoDB 3.4, RabbitMQ and latest version of git + - sudo apt-get install mongodb-org-server mongodb-org-shell erlang rabbitmq-server libffi-dev -y - pip install --upgrade "pip>=19.0,<20.0" - sudo pip install --upgrade "virtualenv==16.6.0" diff --git a/Makefile b/Makefile index d1f28a3aed..c60204f2ff 100644 --- a/Makefile +++ b/Makefile @@ -692,7 +692,7 @@ endif @echo . $(VIRTUALENV_DIR)/bin/activate; \ COVERAGE_FILE=.coverage.integration.orquesta \ - nosetests $(NOSE_OPTS) -s -v \ + nosetests $(NOSE_OPTS) -s -v --exe \ $(NOSE_COVERAGE_FLAGS) $(NOSE_COVERAGE_PACKAGES) st2tests/integration/orquesta || exit 1; \ @@ -940,7 +940,7 @@ ci: ci-checks ci-unit ci-integration ci-mistral ci-packs-tests ci-checks: compile .generated-files-check .pylint .flake8 check-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check check-python-packages .PHONY: ci-py3-unit -ci-py3-unit: +ci-py3-unit: .ci-travis-permissions-workaround @echo @echo "==================== ci-py3-unit ====================" @echo @@ -1005,6 +1005,10 @@ ci-unit-nightly: .ci-prepare-integration: sudo -E ./scripts/travis/prepare-integration.sh +.PHONE: .ci-travis-permissions-workaround +.ci-travis-permissions-workaround: + sudo -E ./scripts/travis/permissions-workaround.sh + .PHONY: ci-integration ci-integration: .ci-prepare-integration .itests-coverage-html @@ -1022,4 +1026,4 @@ ci-mistral: .ci-prepare-integration .ci-prepare-mistral .mistral-itests-coverage ci-orquesta: .ci-prepare-integration .orquesta-itests-coverage-html .PHONY: ci-packs-tests -ci-packs-tests: .packs-tests +ci-packs-tests: .ci-travis-permissions-workaround .packs-tests diff --git a/contrib/core/tests/test_action_sendmail.py b/contrib/core/tests/test_action_sendmail.py index 6881a59b42..353c850fe4 100644 --- a/contrib/core/tests/test_action_sendmail.py +++ b/contrib/core/tests/test_action_sendmail.py @@ -66,7 +66,11 @@ def test_sendmail_default_text_html_content_type(self): 'This message was generated by StackStorm action ' 'send_mail running on %s' % (HOSTNAME)) - status, _, email_data, message = self._run_action(action_parameters=action_parameters) + status, result, email_data, message = self._run_action(action_parameters=action_parameters) + print(status) + print(result) + print(email_data) + print(message) self.assertEquals(status, action_constants.LIVEACTION_STATUS_SUCCEEDED) # Verify subject contains utf-8 charset and is base64 encoded diff --git a/scripts/travis/permissions-workaround.sh b/scripts/travis/permissions-workaround.sh new file mode 100755 index 0000000000..627b2a2ec3 --- /dev/null +++ b/scripts/travis/permissions-workaround.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +if [ "$(whoami)" != 'root' ]; then + echo 'Please run with sudo' + exit 2 +fi + +UBUNTU_VERSION=`lsb_release -a 2>&1 | grep Codename | grep -v "LSB" | awk '{print $2}'` + +# Workaround for Travis on Ubuntu Xenial so local runner integration tests work +# when executing them under user "stanley" (by default Travis checks out the +# code and runs tests under a different system user). +# NOTE: We need to pass "--exe" flag to nosetests when using this workaround. +if [ "${UBUNTU_VERSION}" == "xenial" ]; then + echo "Applying workaround for stanley user permissions issue to /home/travis on Xenial" + chmod 777 -R /home/travis +fi diff --git a/st2common/st2common/transport/bootstrap_utils.py b/st2common/st2common/transport/bootstrap_utils.py index 63ed900a85..f3f8e64214 100644 --- a/st2common/st2common/transport/bootstrap_utils.py +++ b/st2common/st2common/transport/bootstrap_utils.py @@ -105,7 +105,8 @@ def _do_register_exchange(exchange, connection, channel, retry_wrapper): kwargs = { 'exchange': exchange.name, 'type': exchange.type, - 'durable': exchange.durable, + 'durable': False, + 'delivery_mode': 1, # transient 'auto_delete': exchange.auto_delete, 'arguments': exchange.arguments, 'nowait': False, diff --git a/tox.ini b/tox.ini index 3832b40c02..2e8b211b61 100644 --- a/tox.ini +++ b/tox.ini @@ -30,25 +30,25 @@ deps = virtualenv -e{toxinidir}/st2client -e{toxinidir}/st2common commands = - nosetests --rednose --immediate -sv st2actions/tests/unit/ - nosetests --rednose --immediate -sv st2auth/tests/unit/ - nosetests --rednose --immediate -sv st2api/tests/unit/controllers/v1/ - nosetests --rednose --immediate -sv st2api/tests/unit/controllers/exp/ - nosetests --rednose --immediate -sv st2common/tests/unit/ - nosetests --rednose --immediate -sv st2client/tests/unit/ - nosetests --rednose --immediate -sv st2debug/tests/unit/ - nosetests --rednose --immediate -sv st2exporter/tests/unit/ - nosetests --rednose --immediate -sv st2reactor/tests/unit/ - nosetests --rednose --immediate -sv st2stream/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/action_chain_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/inquirer_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/announcement_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/http_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/noop_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/local_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/orquesta_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/python_runner/tests/unit/ - nosetests --rednose --immediate -sv contrib/runners/winrm_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe st2actions/tests/unit/ + nosetests --rednose --immediate -sv --exe st2auth/tests/unit/ + nosetests --rednose --immediate -sv --exe st2api/tests/unit/controllers/v1/ + nosetests --rednose --immediate -sv --exe st2api/tests/unit/controllers/exp/ + nosetests --rednose --immediate -sv --exe st2common/tests/unit/ + nosetests --rednose --immediate -sv --exe st2client/tests/unit/ + nosetests --rednose --immediate -sv --exe st2debug/tests/unit/ + nosetests --rednose --immediate -sv --exe st2exporter/tests/unit/ + nosetests --rednose --immediate -sv --exe st2reactor/tests/unit/ + nosetests --rednose --immediate -sv --exe st2stream/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/action_chain_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/inquirer_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/announcement_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/http_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/noop_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/local_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/orquesta_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/python_runner/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/winrm_runner/tests/unit/ [testenv:py36-unit-nightly] basepython = python3.6 @@ -61,7 +61,7 @@ deps = virtualenv -e{toxinidir}/st2client -e{toxinidir}/st2common commands = - nosetests --rednose --immediate -sv contrib/runners/mistral_v2/tests/unit/ + nosetests --rednose --immediate -sv --exe contrib/runners/mistral_v2/tests/unit/ [testenv:py36-packs] basepython = python3.6