Skip to content

Commit

Permalink
fixed test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
bodepd committed Sep 8, 2010
1 parent 3be3e05 commit d428bac
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 10 deletions.
5 changes: 4 additions & 1 deletion spec/resource/group/should_create_with_gid_spec.sh
Expand Up @@ -8,10 +8,13 @@ source lib/setup.sh
#
# precondition
# - group should not exist
GROUP=bozo$$
GROUP=bozo
if getent group $GROUP; then
groupdel $GROUP
fi

# verify
$BIN/puppet resource group $GROUP ensure=present gid=12768
getent group $GROUP | grep 12768
# postcondition
groupdel $GROUP
3 changes: 3 additions & 0 deletions spec/resource/package/before_spec.sh
@@ -1,3 +1,6 @@
#
# sets up a local test repo used for yum tests
#
mkdir -p /var/yum
deps_path="$( dirname $0 )/deps"
cp -Rf $deps_path/repo /var/yum/
Expand Down
9 changes: 7 additions & 2 deletions spec/resource/package/should_downgrade_spec.sh
@@ -1,9 +1,13 @@
#!/bin/bash

#
# author: Dan Bode
#
# tests that puppet yum provider can downgrade packages.
#
set -e
set -u

source spec/setup.sh
source lib/setup.sh
if ! which rpm ; then NOT_APPLICABLE ; fi

PACKAGE='spectest'
Expand All @@ -22,4 +26,5 @@ $BIN/puppet resource package $PACKAGE ensure=$VERSION | tee $OUTFILE

grep "ensure changed '${OLD_VERSION}' to '${VERSION}'" $OUTFILE
# postcondition
# package should have been downgraded.
[ `rpm -q $PACKAGE` == "${PACKAGE}-${VERSION}" ]
7 changes: 5 additions & 2 deletions spec/resource/package/should_erase_deps_spec.sh
@@ -1,9 +1,12 @@
#!/bin/bash

#
# author: Dan Bode
# ensures that purge for yum resource
# removed depending packages. (not working yet)
set -e
set -u

source spec/setup.sh
source lib/setup.sh

if ! which rpm ; then NOT_APPLICABLE ; fi

Expand Down
7 changes: 6 additions & 1 deletion spec/resource/package/should_install_spec.sh
@@ -1,5 +1,8 @@
#!/bin/bash

#
# author: Dan Bode
# ensures that yum provider can uninstall a package
#
set -e
set -u

Expand All @@ -10,6 +13,7 @@ if ! which rpm ; then NOT_APPLICABLE ; fi
PACKAGE='spectest'

# precondition
# package should not be installed
if rpm -q $PACKAGE; then
rpm -ef $PACKAGE
fi
Expand All @@ -18,5 +22,6 @@ fi
$BIN/puppet resource package $PACKAGE ensure=installed | tee $OUTFILE

# postcondition
# package should be installed
grep 'ensure: created' $OUTFILE
rpm -q $PACKAGE
10 changes: 8 additions & 2 deletions spec/resource/package/should_uninstall_spec.sh
@@ -1,15 +1,20 @@
#!/bin/bash

#
# author: Dan Bode
#
# ensure that yum provider can uninstall a package
#
set -e
set -u

source spec/setup.sh
source lib/setup.sh

if ! which rpm ; then NOT_APPLICABLE ; fi

PACKAGE='spectest'

# precondition
# package should be installed
if ! rpm -q $PACKAGE; then
yum -d 0 -e 0 -y install $PACKAGE
fi
Expand All @@ -19,5 +24,6 @@ $BIN/puppet resource package $PACKAGE ensure=absent | tee $OUTFILE


# postcondition
# package should be uninstalled
grep 'ensure: removed' $OUTFILE
! rpm -q $PACKAGE
9 changes: 7 additions & 2 deletions spec/resource/package/should_upgrade_spec.sh
@@ -1,9 +1,12 @@
#!/bin/bash
# Author: Dan Bode
# ensures that a yum provider can upgrade to a specified version
#

set -e
set -u

source spec/setup.sh
source lib/setup.sh
if ! which rpm ; then NOT_APPLICABLE ; fi

PACKAGE='spectest'
Expand All @@ -12,6 +15,7 @@ OLD_VERSION='1.0-1'
VERSION='1.1-1'

# precondition
# ensure that old versipons of package is installed
if rpm -q $PACKAGE; then
rpm -ef $PACKAGE
fi
Expand All @@ -20,6 +24,7 @@ yum install -d 0 -e 0 -y $PACKAGE-$OLD_VERSION
# run ralsh
$BIN/puppet resource package $PACKAGE ensure=$VERSION | tee $OUTFILE

grep "ensure changed '${OLD_VERSION}' to '${VERSION}'" $OUTFILE
# postcondition
# package should have been upgraded to desired version.
grep "ensure changed '${OLD_VERSION}' to '${VERSION}'" $OUTFILE
[ `rpm -q $PACKAGE` == "${PACKAGE}-${VERSION}" ]

0 comments on commit d428bac

Please sign in to comment.