Skip to content

Commit

Permalink
Merge pull request saltstack#189 from gtmanfred/develop
Browse files Browse the repository at this point in the history
move to make file and upstream python
  • Loading branch information
gtmanfred authored May 1, 2019
2 parents 7413e54 + f15ce58 commit 7d7b178
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 52 deletions.
32 changes: 17 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
dist: xenial
sudo: false
services:
- docker
language: python
cache: pip
services:
- docker

before_install:
- pyenv versions
- pyenv version-name
- env

install:
- pip install tox

Expand All @@ -19,21 +14,28 @@ python:
- '3.4'
- '3.5'
- '3.6'
- '3.7-dev'
- '3.7'
- '3.8-dev'

env:
- SALT=-v2018.3 BACKEND=-cherrypy CODECOV=py
- SALT=-v2018.3 BACKEND=-tornado CODECOV=py
- SALT=-v2019.2 BACKEND=-cherrypy CODECOV=py
- SALT=-v2019.2 BACKEND=-tornado CODECOV=py
- SALT=v2018.3 BACKEND=cherrypy
- SALT=v2018.3 BACKEND=tornado
- SALT=v2019.2 BACKEND=cherrypy
- SALT=v2019.2 BACKEND=tornado
- SALT=develop BACKEND=cherrypy
- SALT=develop BACKEND=tornado

matrix:
env:
allow_failures:
- python: '3.8-dev'
- env: SALT=develop BACKEND=tornado
- env: SALT=develop BACKEND=cherrypy

script:
- PYTHON="${TRAVIS_PYTHON_VERSION%-dev}"
- docker run -v $PWD:/pepper -ti --rm gtmanfred/pepper:latest tox -c /pepper/tox.ini -e "${TRAVIS_PYTHON_VERSION%%.*}flake8,${CODECOV}${PYTHON//./}${BACKEND}${SALT}"
- PYTHON="${TRAVIS_PYTHON_VERSION/-dev/-rc}"
- TOX_VERSION="py${PYTHON//./}"
- docker run -v $PWD:/pepper -ti --rm "python:$PYTHON" make -C /pepper test PYVERSION="${TOX_VERSION%-rc}" SALT="${SALT}" BACKEND="${BACKEND}"

after_success:
- sudo chown $USER .tox/
- if [[ $CODECOV == "py" ]]; then tox -e codecov; fi
- tox -e codecov
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PYVERSION?=py37
SALT?=v2019.2
BACKEND?=cherrypy
DEBIAN_FRONTEND=noninteractive

install:
apt update && apt install -y libc6-dev libffi-dev gcc git openssh-server libzmq3-dev
pip install tox

test: install
tox -e flake8,$(PYVERSION)-$(BACKEND)-$(SALT)
179 changes: 179 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
trigger:
- develop

jobs:

- job: test_pepper
pool:
vmImage: 'Ubuntu-16.04'
strategy:
matrix:
py2.7-v2018.3-cherrypy:
python.version: '2.7'
version: py27
salt: v2018.3
backend: cherrypy
py2.7-v2019.2-cherrypy:
python.version: '2.7'
version: py27
salt: v2019.2
backend: cherrypy
py2.7-develop-cherrypy:
python.version: '2.7'
version: py27
salt: develop
backend: cherrypy
py2.7-v2018.3-tornado:
python.version: '2.7'
version: py27
salt: v2018.3
backend: tornado
py2.7-v2019.2-tornado:
python.version: '2.7'
version: py27
salt: v2019.2
backend: tornado
py2.7-develop-tornado:
python.version: '2.7'
version: py27
salt: develop
backend: tornado
py3.4-v2018.3-cherrypy:
python.version: '3.4'
version: py34
salt: v2018.3
backend: cherrypy
py3.4-v2019.2-cherrypy:
python.version: '3.4'
version: py34
salt: v2019.2
backend: cherrypy
py3.4-develop-cherrypy:
python.version: '3.4'
version: py34
salt: develop
backend: cherrypy
py3.4-v2018.3-tornado:
python.version: '3.4'
version: py34
salt: v2018.3
backend: tornado
py3.4-v2019.2-tornado:
python.version: '3.4'
version: py34
salt: v2019.2
backend: tornado
py3.4-develop-tornado:
python.version: '3.4'
version: py34
salt: develop
backend: tornado
py3.5-v2018.3-cherrypy:
python.version: '3.5'
version: py35
salt: v2018.3
backend: cherrypy
py3.5-v2019.2-cherrypy:
python.version: '3.5'
version: py35
salt: v2019.2
backend: cherrypy
py3.5-develop-cherrypy:
python.version: '3.5'
version: py35
salt: develop
backend: cherrypy
py3.5-v2018.3-tornado:
python.version: '3.5'
version: py35
salt: v2018.3
backend: tornado
py3.5-v2019.2-tornado:
python.version: '3.5'
version: py35
salt: v2019.2
backend: tornado
py3.5-develop-tornado:
python.version: '3.5'
version: py35
salt: develop
backend: tornado
py3.6-v2018.3-cherrypy:
python.version: '3.6'
version: py36
salt: v2018.3
backend: cherrypy
py3.6-v2019.2-cherrypy:
python.version: '3.6'
version: py36
salt: v2019.2
backend: cherrypy
py3.6-develop-cherrypy:
python.version: '3.6'
version: py36
salt: develop
backend: cherrypy
py3.6-v2018.3-tornado:
python.version: '3.6'
version: py36
salt: v2018.3
backend: tornado
py3.6-v2019.2-tornado:
python.version: '3.6'
version: py36
salt: v2019.2
backend: tornado
py3.6-develop-tornado:
python.version: '3.6'
version: py36
salt: develop
backend: tornado
py3.7-v2017.3-cherrypy:
python.version: '3.7'
version: py37
salt: v2017.3
backend: cherrypy
py3.7-v2019.2-cherrypy:
python.version: '3.7'
version: py37
salt: v2019.2
backend: cherrypy
py3.7-develop-cherrypy:
python.version: '3.7'
version: py37
salt: develop
backend: cherrypy
py3.7-v2017.3-tornado:
python.version: '3.7'
version: py37
salt: v2017.3
backend: tornado
py3.7-v2019.2-tornado:
python.version: '3.7'
version: py37
salt: v2019.2
backend: tornado
py3.7-develop-tornado:
python.version: '3.7'
version: py37
salt: develop
backend: tornado

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: x64

- script: |
pip install tox
displayName: Install dependencies
- script: |
docker run -v $PWD:/pepper --rm "python:$(python.version)" make -C /pepper test PYTHON_VERSION=$(version) SALT=$(salt) BACKEND=$(backend)
displayName: pytest
- script: |
sudo chown $USER .tox/
tox -e codecov
displayName: codecov
env:
CODECOV_TOKEN: '16c2a232-4329-438c-b163-ccbfeeab47aa'
19 changes: 0 additions & 19 deletions tests/Dockerfile

This file was deleted.

15 changes: 14 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals, print_function

# Import python libraries
import distutils.spawn
import logging
import os.path
import shutil
Expand All @@ -10,6 +11,8 @@
import textwrap

# Import Salt Libraries
import salt.client
import salt.config
import salt.utils.yaml as yaml

# Import pytest libraries
Expand All @@ -26,6 +29,16 @@
log = logging.getLogger(__name__)


@pytest.fixture(scope='session')
def install_sshd_server():
if distutils.spawn.find_executable('sshd'):
return
__opts__ = salt.config.minion_config('tests/minion.conf')
__opts__['file_client'] = 'local'
caller = salt.client.Caller(mopts=__opts__)
caller.cmd('pkg.install', 'openssh-server')


class SaltApi(SaltDaemonScriptBase):
'''
Class which runs the salt-api daemon
Expand Down Expand Up @@ -109,7 +122,7 @@ def output_file():


@pytest.fixture(params=['/run', '/login'])
def pepper_cli(request, session_salt_api, salt_api_port, output_file, session_sshd_server):
def pepper_cli(request, session_salt_api, salt_api_port, output_file, install_sshd_server, session_sshd_server):
'''
Wrapper to invoke Pepper with common params and inside an empty env
'''
Expand Down
5 changes: 1 addition & 4 deletions tests/integration/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ def test_runner_client(pepper_cli):
)
def test_wheel_client_arg(pepper_cli, session_minion_id):
ret = pepper_cli('--client=wheel', 'minions.connected')
# note - this seems not to work in returning session_minion_id with current runner, returning []
# the test originally was asserting the success atr but that isn't returned anymore
# further debugging needed with pytest-salt
assert ret == []
assert ret == ['pytest-session-salt-minion-0']


@pytest.mark.xfail(
Expand Down
18 changes: 5 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,34,35,36}-{cherrypy,tornado}-{v2018.3,v2019.2},coverage,flake8
envlist = py{27,34,35,36,37,38}-{cherrypy,tornado}-{v2018.3,v2019.2,develop},coverage,flake8
skip_missing_interpreters = true
skipsdist = false

Expand All @@ -13,18 +13,10 @@ deps = -r{toxinidir}/tests/requirements.txt
changedir = {toxinidir}
setenv = COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
commands =
cherrypy: pytest --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_cherrypy
tornado: pytest --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_tornado
cherrypy: pytest -v --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_cherrypy
tornado: pytest -v --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_tornado

[testenv:2flake8]
basepython = python2
deps =
-r {toxinidir}/tests/requirements.txt
flake8
commands = flake8 tests/ pepper/ scripts/pepper setup.py

[testenv:3flake8]
basepython = python3
[testenv:flake8]
deps =
-r {toxinidir}/tests/requirements.txt
flake8
Expand Down Expand Up @@ -57,7 +49,7 @@ changedir = {toxinidir}/htmlcov
commands = python -m http.server

[pytest]
addopts = --showlocals --log-file /tmp/pepper-runtests.log --no-print-logs -ra -sv
addopts = --showlocals --log-file /tmp/pepper-runtests.log --no-print-logs -ra
testpaths = tests
norecursedirs = .git .tox
usefixtures = pepperconfig
Expand Down

0 comments on commit 7d7b178

Please sign in to comment.