summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2013-10-29 09:27:36 +0000
committerBen Brown <ben.brown@codethink.co.uk>2013-10-29 09:27:36 +0000
commit496357d52383d438bf8ed363f8d614736fa63401 (patch)
tree787b28100ab4bb3ff70808cd952b856649b6e5e7
parent73bee6181496b76f50a63547d1bb850427c5f334 (diff)
parent9c3af1a2232ed50e9b00cb13cc8917a9fe519294 (diff)
downloadtbdiff-496357d52383d438bf8ed363f8d614736fa63401.tar.gz
Merge branch 'benbrown/yarns'
-rw-r--r--yarns/create-deploy.yarn140
1 files changed, 94 insertions, 46 deletions
diff --git a/yarns/create-deploy.yarn b/yarns/create-deploy.yarn
index 872b15d..6cb9a4a 100644
--- a/yarns/create-deploy.yarn
+++ b/yarns/create-deploy.yarn
@@ -5,84 +5,126 @@ The following scenarios test tbdiff-deploy's ability to correctly transform
the content of a target directory, to that of a source directory, given an
appropriate binary delta created by tbdiff-create.
-Changing of file content
-------------------------
+Changing of a file's content
+----------------------------
This simple test checks that file content is as expected, if the content of
the two text files are different, the test will fail.
- SCENARIO Changing a file's content works
+ SCENARIO Changing a regular file's content works
GIVEN a directory exists named 'A'
- AND the directory 'A' contains a file named 'foo.txt' with '1' in it
+ AND the directory 'A' contains a regular file named 'foo.txt' with '1' in it
AND a directory exists named 'B'
- AND the directory 'B' contains a file named 'foo.txt' with '2' in it
+ AND the directory 'B' contains a regular file named 'foo.txt' with '2' in it
WHEN tbdiff-create creates a binary delta named 'AB.tbdiff' from 'A' to 'B'
AND tbdiff-deploy applies the delta 'AB.tbdiff' to 'A'
THEN the files 'A/foo.txt' and 'B/foo.txt' have the same contents
-Changing of file ownership
---------------------------
+Changing of a file's ownership
+------------------------------
-Trebuchet also takes into account POSIX metadata such as ownership, this
-scenario is written to test that functionality.
+Trebuchet also takes into account POSIX metadata such as ownership, these
+scenarios are written to test that functionality.
- SCENARIO Changing a file's group ownership works
+ SCENARIO Changing a regular file's group ownership works
GIVEN a directory exists named 'C'
- AND the directory 'C' contains a file named 'bar'
+ AND the directory 'C' contains a regular file named 'bar'
AND a directory exists named 'D'
- AND the directory 'D' contains a file named 'bar'
+ AND the directory 'D' contains a regular file named 'bar'
AND the file 'D/bar' is owned by the group '893'
WHEN tbdiff-create creates a binary delta named 'CD.tbdiff' from 'C' to 'D'
AND tbdiff-deploy applies the delta 'CD.tbdiff' to 'C'
THEN the file 'C/bar' is owned by the group '893'
-Changing of file permissions
-----------------------------
-
-This scenario tests that file permissions are successfully changed after
-the deployment of a binary delta.
-
- SCENARIO Changing a file's permissions works
+ SCENARIO Changing a named pipe's group ownership works
GIVEN a directory exists named 'E'
- AND the directory 'E' contains a file named 'baz'
+ AND the directory 'E' contains the named pipe 'red'
AND a directory exists named 'F'
- AND the directory 'F' contains a file named 'baz'
- AND the file 'F/baz' has the permissions 'ugo=rw'
+ AND the directory 'F' contains the named pipe 'red'
+ AND the file 'F/red' is owned by the group '594'
WHEN tbdiff-create creates a binary delta named 'EF.tbdiff' from 'E' to 'F'
AND tbdiff-deploy applies the delta 'EF.tbdiff' to 'E'
- THEN the file 'E/baz' has the permissions '-rw-rw-rw-'
+ THEN the file 'E/red' is owned by the group '594'
-Adding and removing of a file
------------------------------
+Changing of a file's permissions
+--------------------------------
-The following scenario checks that the deploying of a binary delta
-successfully removes and creates the appropriate files.
+These scenarios test that file permissions are successfully changed after
+the deployment of a binary delta.
- SCENARIO Adding and removing of files works
+ SCENARIO Changing a file's permissions works
GIVEN a directory exists named 'G'
- AND the directory 'G' contains a file named 'minus'
+ AND the directory 'G' contains a regular file named 'baz'
AND a directory exists named 'H'
- AND the directory 'H' contains a file named 'plus'
+ AND the directory 'H' contains a regular file named 'baz'
+ AND the file 'H/baz' has the permissions 'ugo=rw'
WHEN tbdiff-create creates a binary delta named 'GH.tbdiff' from 'G' to 'H'
AND tbdiff-deploy applies the delta 'GH.tbdiff' to 'G'
- THEN the file 'G/minus' no longer exists
- AND the directory 'G' contains a file named 'plus'
+ THEN the file 'G/baz' has the permissions '-rw-rw-rw-'
+
+ SCENARIO Changing a named pipe's permissions works
+ GIVEN a directory exists named 'I'
+ AND the directory 'I' contains the named pipe 'orange'
+ AND a directory exists named 'J'
+ AND the directory 'J' contains the named pipe 'orange'
+ AND the file 'J/orange' has the permissions 'ug=rw,o=r'
+ WHEN tbdiff-create creates a binary delta named 'IJ.tbdiff' from 'I' to 'J'
+ AND tbdiff-deploy applies the delta 'IJ.tbdiff' to 'I'
+ THEN the file 'I/orange' has the permissions 'prw-rw-r--'
+
+Adding and removing of files
+----------------------------
+
+The following scenarios check that the deploying of a binary delta
+successfully removes and creates the appropriate files.
+
+ SCENARIO Adding and removing of regular files works
+ GIVEN a directory exists named 'K'
+ AND the directory 'K' contains a regular file named 'minus'
+ AND a directory exists named 'L'
+ AND the directory 'L' contains a regular file named 'plus'
+ WHEN tbdiff-create creates a binary delta named 'KL.tbdiff' from 'K' to 'L'
+ AND tbdiff-deploy applies the delta 'KL.tbdiff' to 'K'
+ THEN the file 'K/minus' no longer exists
+ AND the directory 'K' contains a file named 'plus'
+
+ SCENARIO Adding and removing of named pipes works
+ GIVEN a directory exists named 'M'
+ AND the directory 'M' contains the named pipe 'yellow'
+ AND a directory exists named 'N'
+ AND the directory 'N' contains the named pipe 'green'
+ WHEN tbdiff-create creates a binary delta named 'MN.tbdiff' from 'M' to 'N'
+ AND tbdiff-deploy applies the delta 'MN.tbdiff' to 'M'
+ THEN the file 'M/yellow' no longer exists
+ AND the directory 'M' contains the named pipe 'green'
Changing modification time of a file
------------------------------------
-Here we check that modification times are correctly changed, if modification
-times are no identical, the test fails.
+In the following scenarios we check that modification times are correctly
+changed, if modification times are not identical, the test fails.
SCENARIO Changing a file's modification time works
- GIVEN a directory exists named 'I'
- AND the directory 'I' contains a file named 'hurr' with '1' in it
- AND a directory exists named 'J'
- AND the directory 'J' contains a file named 'hurr' with '1' in it
- AND the file 'J/hurr' has it's modification time set to '06:39'
- WHEN tbdiff-create creates a binary delta named 'IJ.tbdiff' from 'I' to 'J'
- AND tbdiff-deploy applies the delta 'IJ.tbdiff' to 'I'
- THEN the files 'I/hurr' and 'J/hurr' have the same modification time
+ GIVEN a directory exists named 'O'
+ AND the directory 'O' contains a regular file named 'hurr' with '1' in it
+ AND the file 'O/hurr' has its modification time set to '@793042334'
+ AND a directory exists named 'P'
+ AND the directory 'P' contains a regular file named 'hurr' with '1' in it
+ AND the file 'P/hurr' has its modification time set to '@683074800'
+ WHEN tbdiff-create creates a binary delta named 'OP.tbdiff' from 'O' to 'P'
+ AND tbdiff-deploy applies the delta 'OP.tbdiff' to 'O'
+ THEN the files 'O/hurr' and 'P/hurr' have the same modification time
+
+ SCENARIO Changing a named pipe's modification time works
+ GIVEN a directory exists named 'Q'
+ AND the directory 'Q' contains the named pipe 'blue'
+ AND the file 'Q/blue' has its modification time set to '@1381758015'
+ AND a directory exists named 'R'
+ AND the directory 'R' contains the named pipe 'blue'
+ AND the file 'R/blue' has its modification time set to '@683074800'
+ WHEN tbdiff-create creates a binary delta named 'QR.tbdiff' from 'Q' to 'R'
+ AND tbdiff-deploy applies the delta 'QR.tbdiff' to 'Q'
+ THEN the files 'Q/blue' and 'R/blue' have the same modification time
IMPLEMENTS
==========
@@ -93,10 +135,10 @@ Implementations for the creating and deploying of binary deltas
IMPLEMENTS GIVEN a directory exists named '([^']+)'
mkdir "$DATADIR/$MATCH_1"
- IMPLEMENTS GIVEN the directory '([^']+)' contains a file named '([^']+)' with '([^']+)' in it
+ IMPLEMENTS GIVEN the directory '([^']+)' contains a regular file named '([^']+)' with '([^']+)' in it
echo "$MATCH_3" > "$DATADIR/$MATCH_1/$MATCH_2"
- IMPLEMENTS GIVEN the directory '([^']+)' contains a file named '([^']+)'
+ IMPLEMENTS GIVEN the directory '([^']+)' contains a regular file named '([^']+)'
touch "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS GIVEN the file '([^']+)' is owned by the group '([^']+)'
@@ -105,8 +147,11 @@ Implementations for the creating and deploying of binary deltas
IMPLEMENTS GIVEN the file '([^']+)' has the permissions '([^']+)'
chmod "$MATCH_2" "$DATADIR/$MATCH_1"
- IMPLEMENTS GIVEN the file '([^']+)' has it's modification time set to '([^']+)'
- touch -md "$MATCH_2" "$DATADIR/$MATCH_1"
+ IMPLEMENTS GIVEN the file '([^']+)' has its modification time set to '([^']+)'
+ touch -d "$MATCH_2" "$DATADIR/$MATCH_1"
+
+ IMPLEMENTS GIVEN the directory '([^']+)' contains the named pipe '([^']+)'
+ mkfifo "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS WHEN tbdiff-create creates a binary delta named '([^']+)' from '([^']+)' to '([^']+)'
"$SRCDIR/tbdiff-create/tbdiff-create" "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3"
@@ -132,3 +177,6 @@ Implementations for the creating and deploying of binary deltas
IMPLEMENTS THEN the files '([^']+)' and '([^']+)' have the same modification time
test "$(stat -c %y "$DATADIR/$MATCH_1")" = "$(stat -c %y "$DATADIR/$MATCH_2")"
+
+ IMPLEMENTS THEN the directory '([^']+)' contains the named pipe '([^']+)'
+ test -p "$DATADIR/$MATCH_1/$MATCH_2"