blob: 872b15d38342bef76e759e7aa6bd69b601060c59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
Trebuchet tests for the creating and deploying of binary deltas
===============================================================
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
------------------------
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
GIVEN a directory exists named 'A'
AND the directory 'A' contains a 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
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
--------------------------
Trebuchet also takes into account POSIX metadata such as ownership, this
scenario is written to test that functionality.
SCENARIO Changing a file's group ownership works
GIVEN a directory exists named 'C'
AND the directory 'C' contains a file named 'bar'
AND a directory exists named 'D'
AND the directory 'D' contains a 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
GIVEN a directory exists named 'E'
AND the directory 'E' contains a file named 'baz'
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'
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-'
Adding and removing of a file
-----------------------------
The following scenario checks that the deploying of a binary delta
successfully removes and creates the appropriate files.
SCENARIO Adding and removing of files works
GIVEN a directory exists named 'G'
AND the directory 'G' contains a file named 'minus'
AND a directory exists named 'H'
AND the directory 'H' contains a file named 'plus'
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'
Changing modification time of a file
------------------------------------
Here we check that modification times are correctly changed, if modification
times are no 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
IMPLEMENTS
==========
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
echo "$MATCH_3" > "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS GIVEN the directory '([^']+)' contains a file named '([^']+)'
touch "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS GIVEN the file '([^']+)' is owned by the group '([^']+)'
chgrp "$MATCH_2" "$DATADIR/$MATCH_1"
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 WHEN tbdiff-create creates a binary delta named '([^']+)' from '([^']+)' to '([^']+)'
"$SRCDIR/tbdiff-create/tbdiff-create" "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2" "$DATADIR/$MATCH_3"
IMPLEMENTS WHEN tbdiff-deploy applies the delta '([^']+)' to '([^']+)'
cd "$DATADIR/$MATCH_2"
"$SRCDIR/tbdiff-deploy/tbdiff-deploy" "$DATADIR/$MATCH_1"
IMPLEMENTS THEN the files '([^']+)' and '([^']+)' have the same contents
diff "$DATADIR/$MATCH_1" "$DATADIR/$MATCH_2"
IMPLEMENTS THEN the file '([^']+)' is owned by the group '([^']+)'
test "$(stat -c %g "$DATADIR/$MATCH_1")" = "$MATCH_2"
IMPLEMENTS THEN the file '([^']+)' has the permissions '([^']+)'
test "$(stat -c %A "$DATADIR/$MATCH_1")" = "$MATCH_2"
IMPLEMENTS THEN the file '([^']+)' no longer exists
test ! -e "$DATADIR/$MATCH_1"
IMPLEMENTS THEN the directory '([^']+)' contains a file named '([^']+)'
test -f "$DATADIR/$MATCH_1/$MATCH_2"
IMPLEMENTS THEN the files '([^']+)' and '([^']+)' have the same modification time
test "$(stat -c %y "$DATADIR/$MATCH_1")" = "$(stat -c %y "$DATADIR/$MATCH_2")"
|