mirror of
https://github.com/deajan/osync
synced 2024-11-17 09:25:42 +00:00
Improved unit tests
This commit is contained in:
parent
7256055042
commit
939bc45dc7
@ -11,8 +11,8 @@ TESTS_DIR="$DEV_DIR/tests"
|
||||
|
||||
OSYNC_EXECUTABLE="osync.sh"
|
||||
|
||||
INITIATOR_DIR="$TESTS_DIR/opt/osync/initiator"
|
||||
TARGET_DIR="$TESTS_DIR/opt/osync/target"
|
||||
INITIATOR_DIR="${HOME}/osync/initiator"
|
||||
TARGET_DIR="${HOME}/osync/target"
|
||||
OSYNC_STATE_DIR=".osync_workdir/state"
|
||||
|
||||
function CreateReplicas () {
|
||||
@ -29,18 +29,11 @@ function CreateReplicas () {
|
||||
|
||||
function oneTimeSetUp () {
|
||||
source "$DEV_DIR/ofunctions.sh"
|
||||
|
||||
if grep "^IS_STABLE=YES" "$DEV_DIR/$OSYNC_EXECUTABLE" > /dev/null; then
|
||||
IS_STABLE=yes
|
||||
else
|
||||
IS_STABLE=no
|
||||
sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$DEV_DIR/$OSYNC_EXECUTABLE"
|
||||
fi
|
||||
}
|
||||
|
||||
function oneTimeTearDown () {
|
||||
if [ "$IS_STABLE" == "no" ]; then
|
||||
sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$DEV_DIR/$OSYNC_EXECUTABLE"
|
||||
sed -i.tmp 's/^IS_STABLE=yes/IS_STABLE=no/' "$OSYNC_DIR/$OSYNC_EXECUTABLE"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -50,10 +43,21 @@ function test_Merge () {
|
||||
assertEquals "Merging code" "0" $?
|
||||
}
|
||||
|
||||
function test_SetStable () {
|
||||
if grep "^IS_STABLE=YES" "$OSYNC_DIR/$OSYNC_EXECUTABLE" > /dev/null; then
|
||||
IS_STABLE=yes
|
||||
echo "Is already set as stable"
|
||||
else
|
||||
IS_STABLE=no
|
||||
sed -i.tmp 's/^IS_STABLE=no/IS_STABLE=yes/' "$OSYNC_DIR/$OSYNC_EXECUTABLE"
|
||||
assertEquals "Set as stable" "0" $?
|
||||
fi
|
||||
}
|
||||
|
||||
function test_osync_quicksync_local () {
|
||||
CreateReplicas
|
||||
cd "$DEV_DIR"
|
||||
./$OSYNC_EXECUTABLE --initiator="$INITIATOR_DIR" --target="$TARGET_DIR" > /dev/null
|
||||
cd "$OSYNC_DIR"
|
||||
./$OSYNC_EXECUTABLE --initiator="$INITIATOR_DIR" --target="$TARGET_DIR"
|
||||
assertEquals "Return code" "0" $?
|
||||
|
||||
[ -d "$INITIATOR_DIR/$OSYNC_STATE_DIR" ]
|
||||
@ -66,7 +70,7 @@ function test_osync_quicksync_local () {
|
||||
|
||||
function test_osync_quicksync_remote () {
|
||||
CreateReplicas
|
||||
cd "$DEV_DIR"
|
||||
cd "$OSYNC_DIR"
|
||||
./$OSYNC_EXECUTABLE --initiator="$INITIATOR_DIR" --target="ssh://localhost:49999/$TARGET_DIR" --rsakey=/root/.ssh/id_rsa_local > /dev/null
|
||||
assertEquals "Return code" "0" $?
|
||||
|
||||
|
@ -11,8 +11,8 @@ TESTS_DIR="$DEV_DIR/tests"
|
||||
|
||||
OSYNC_EXECUTABLE="osync.sh"
|
||||
|
||||
INITIATOR_DIR="$TESTS_DIR/opt/osync/initiator"
|
||||
TARGET_DIR="$TESTS_DIR/opt/osync/target"
|
||||
INITIATOR_DIR="${HOME}/osync/initiator"
|
||||
TARGET_DIR="${HOME}/osync/target"
|
||||
OSYNC_STATE_DIR=".osync_workdir/state"
|
||||
|
||||
function CreateReplicas () {
|
||||
@ -29,18 +29,11 @@ function CreateReplicas () {
|
||||
|
||||
function oneTimeSetUp () {
|
||||
source "$DEV_DIR/ofunctions.sh"
|
||||
|
||||
if grep "^IS_STABLE=YES" "$DEV_DIR/$OSYNC_EXECUTABLE" > /dev/null; then
|
||||
IS_STABLE=yes
|
||||
else
|
||||
IS_STABLE=no
|
||||
sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$DEV_DIR/$OSYNC_EXECUTABLE"
|
||||
fi
|
||||
}
|
||||
|
||||
function oneTimeTearDown () {
|
||||
if [ "$IS_STABLE" == "no" ]; then
|
||||
sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$DEV_DIR/$OSYNC_EXECUTABLE"
|
||||
sed -i.tmp 's/^IS_STABLE=yes/IS_STABLE=no/' "$OSYNC_DIR/$OSYNC_EXECUTABLE"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -50,10 +43,21 @@ function test_Merge () {
|
||||
assertEquals "Merging code" "0" $?
|
||||
}
|
||||
|
||||
function test_SetStable () {
|
||||
if grep "^IS_STABLE=YES" "$OSYNC_DIR/$OSYNC_EXECUTABLE" > /dev/null; then
|
||||
IS_STABLE=yes
|
||||
echo "Is already set as stable"
|
||||
else
|
||||
IS_STABLE=no
|
||||
sed -i.tmp 's/^IS_STABLE=no/IS_STABLE=yes/' "$OSYNC_DIR/$OSYNC_EXECUTABLE"
|
||||
assertEquals "Set as stable" "0" $?
|
||||
fi
|
||||
}
|
||||
|
||||
function test_osync_quicksync_local () {
|
||||
CreateReplicas
|
||||
cd "$DEV_DIR"
|
||||
./$OSYNC_EXECUTABLE --initiator="$INITIATOR_DIR" --target="$TARGET_DIR" > /dev/null
|
||||
cd "$OSYNC_DIR"
|
||||
./$OSYNC_EXECUTABLE --initiator="$INITIATOR_DIR" --target="$TARGET_DIR"
|
||||
assertEquals "Return code" "0" $?
|
||||
|
||||
[ -d "$INITIATOR_DIR/$OSYNC_STATE_DIR" ]
|
||||
|
Loading…
Reference in New Issue
Block a user