Add the failing test for saltstack/salt#1879

This commit is contained in:
Pedro Algarvio 2012-08-26 00:38:39 +01:00
parent 269bef7112
commit 797defc320
4 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,3 @@
/tmp/salttest/issue-1879:
file:
- touch

View file

@ -0,0 +1,8 @@
/tmp/salttest/issue-1879:
file.append:
- text: |
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi

View file

@ -0,0 +1,8 @@
/tmp/salttest/issue-1879:
file.append:
- text: |
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi

View file

@ -1,4 +1,5 @@
# Import python libs
import os
import integration
@ -64,6 +65,26 @@ class StateModuleTest(integration.ModuleCase):
'multiple state decs of the same type', sls
)
def test_issue_1879_too_simple_contains_check(self):
# Create the file
self.run_function('state.sls', mods='issue-1879')
# The first append
self.run_function('state.sls', mods='issue-1879.step-1')
# The seccond append
self.run_function('state.sls', mods='issue-1879.step-2')
# Does it match?
self.assertMultiLineEqual("""\
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi""", open("/tmp/salttest/issue-1879", "r").read())
os.unlink('/tmp/salttest/issue-1879')
if __name__ == '__main__':
from integration import run_tests