Skip to content

Commit

Permalink
Merge df05a78 into d3815e8
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Jun 6, 2018
2 parents d3815e8 + df05a78 commit 1d8c0a4
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See: https://blog.github.com/2017-07-06-introducing-code-owners/
# These owners will be the default owners for everything in the repo.
* @coi-gov-pl/puppet-team
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ recursive-include integration_tests */Dockerfile

# Exclude environment files
prune .circleci
prune .github
2 changes: 1 addition & 1 deletion integration_tests/scripts/install-develop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ root=$(dirname $(dirname $(dirname ${here})))

set -x

pip install -e ${root}
LC_ALL=C pip install -e ${root}
33 changes: 33 additions & 0 deletions integration_tests/test_ubuntu_1604.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import pytest
from os.path import join

Expand All @@ -10,6 +11,38 @@ def sut():
return join('debian', 'ubuntu-1604')


@pytest.mark.ubuntu1604
def test_puppeter_develop_install_on_ubuntu_1604_with_invalid_locale(phial, capsys, regex):
with capsys.disabled():
acceptance = PuppeterAcceptance(phial)
pattern = re.compile('^puppeter \d+\.\d+\.\d+(?:\.[a-z0-9]+)?$')

phial.exec('echo "export LC_ALL=mn-Mong-CN.UTF-8" >> /etc/profile.d/mandarin.sh')
acceptance.install_puppeter()
phial.exec('rm -vf /etc/profile.d/mandarin.sh')

exitcode, output, error = phial.exec('puppeter --version', capture=True)
assert error == ''
regex.pattern(pattern).matches(output)
assert exitcode == 0


@pytest.mark.ubuntu1604
def test_puppeter_production_install_on_ubuntu_1604_with_invalid_locale(phial, capsys, regex):
with capsys.disabled():
pattern = re.compile('^puppeter \d+\.\d+\.\d+(?:\.[a-z0-9]+)?$')

phial.exec('echo "export LC_ALL=mn-Mong-CN.UTF-8" >> /etc/profile.d/mandarin.sh')
exitcode, output, error = phial.exec('/puppeter-setup.sh')
assert exitcode == 0
phial.exec('rm -vf /etc/profile.d/mandarin.sh')

exitcode, output, error = phial.exec('puppeter --version', capture=True)
assert error == ''
regex.pattern(pattern).matches(output)
assert exitcode == 0


@pytest.mark.ubuntu1604
def test_agent_system_on_ubuntu_1604(phial, capsys, regex):
with capsys.disabled():
Expand Down
5 changes: 0 additions & 5 deletions puppeter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ def get_logger(cls):

def __fullname(cls):
return cls.__module__ + "." + cls.__name__


if __name__ == '__main__':
from puppeter.main import main
main()
4 changes: 3 additions & 1 deletion puppeter/__main__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from puppeter.main import main
main()

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ elif [ $osfamily == debian ]; then
fi
fi
if [ $MODE == puppeter ]; then
run pip install puppeter
run LC_ALL=C pip install puppeter
fi
21 changes: 21 additions & 0 deletions tests/test__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import re

import pytest

from tests.helpers.commandline import captured_output


def test_usage_printout():
from puppeter import __main__

with pytest.raises(SystemExit) as sysexit:
with captured_output() as (out, err):
__main__.main(['puppeter', '--help'])

stdout = out.getvalue().strip()
stderr = err.getvalue().strip()
assert sysexit.value.code == 0
assert stdout == ''
assert re.compile('Puppeter', re.MULTILINE).search(stderr)
assert re.compile('--answers FILE, -a FILE', re.MULTILINE).search(stderr)
assert re.compile('--execute, -e', re.MULTILINE).search(stderr)

0 comments on commit 1d8c0a4

Please sign in to comment.