Skip to content

Commit fd4bc1e

Browse files
committed
tests: add files and hardlinks in testing tree
1 parent 9942594 commit fd4bc1e

File tree

6 files changed

+95
-82
lines changed

6 files changed

+95
-82
lines changed

test/tests/lib.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,19 @@ def create_filetree_from_yaml(path: str, layout: str):
223223
file1: {}
224224
file2: {}
225225
file3: {}
226+
file4: {}
226227
symlink2:
227228
type: symlink
228229
target: file2
229230
hardlink3:
230231
type: hardlink
231232
target: file3
233+
hardlink4.0:
234+
type: hardlink
235+
target: file4
236+
hardlink4.1:
237+
type: hardlink
238+
target: file4
232239
dir1:
233240
type: dir
234241
layout:

test/tests/test_dcmp.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_dcmp(self):
4141
proc,
4242
textwrap.dedent(
4343
"""
44-
Items : 9
44+
Items : 12
4545
"""
4646
),
4747
)
@@ -53,11 +53,11 @@ def test_dcmp_after_dsync(self):
5353
proc,
5454
textwrap.dedent(
5555
"""
56-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
56+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
5757
Number of items that exist only in one directory: 0 (Src: 0 Dest: 0)
58-
Number of items that exist in both directories and have the same type: 9 (Src: 9 Dest: 9)
58+
Number of items that exist in both directories and have the same type: 12 (Src: 12 Dest: 12)
5959
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
60-
Number of items that exist in both directories and have the same content: 9 (Src: 9 Dest: 9)
60+
Number of items that exist in both directories and have the same content: 12 (Src: 12 Dest: 12)
6161
Number of items that exist in both directories and have different contents: 0 (Src: 0 Dest: 0)
6262
"""
6363
),
@@ -71,11 +71,11 @@ def test_dcmp_additional_file(self):
7171
proc,
7272
textwrap.dedent(
7373
"""
74-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
74+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
7575
Number of items that exist only in one directory: N/A (Src: 0 Dest: 1)
76-
Number of items that exist in both directories and have the same type: 9 (Src: 9 Dest: 9)
76+
Number of items that exist in both directories and have the same type: 12 (Src: 12 Dest: 12)
7777
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
78-
Number of items that exist in both directories and have the same content: 9 (Src: 9 Dest: 9)
78+
Number of items that exist in both directories and have the same content: 12 (Src: 12 Dest: 12)
7979
Number of items that exist in both directories and have different contents: 0 (Src: 0 Dest: 0)
8080
"""
8181
),
@@ -89,11 +89,11 @@ def test_dcmp_missing_file(self):
8989
proc,
9090
textwrap.dedent(
9191
"""
92-
Number of items that exist in both directories: 8 (Src: 8 Dest: 8)
92+
Number of items that exist in both directories: 11 (Src: 11 Dest: 11)
9393
Number of items that exist only in one directory: N/A (Src: 1 Dest: 0)
94-
Number of items that exist in both directories and have the same type: 8 (Src: 8 Dest: 8)
94+
Number of items that exist in both directories and have the same type: 11 (Src: 11 Dest: 11)
9595
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
96-
Number of items that exist in both directories and have the same content: 8 (Src: 8 Dest: 8)
96+
Number of items that exist in both directories and have the same content: 11 (Src: 11 Dest: 11)
9797
Number of items that exist in both directories and have different contents: 0 (Src: 0 Dest: 0)
9898
"""
9999
),
@@ -109,11 +109,11 @@ def test_dcmp_different_type(self):
109109
proc,
110110
textwrap.dedent(
111111
"""
112-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
112+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
113113
Number of items that exist only in one directory: 0 (Src: 0 Dest: 0)
114-
Number of items that exist in both directories and have the same type: 8 (Src: 8 Dest: 8)
114+
Number of items that exist in both directories and have the same type: 11 (Src: 11 Dest: 11)
115115
Number of items that exist in both directories and have different types: 1 (Src: 1 Dest: 1)
116-
Number of items that exist in both directories and have the same content: 8 (Src: 8 Dest: 8)
116+
Number of items that exist in both directories and have the same content: 11 (Src: 11 Dest: 11)
117117
Number of items that exist in both directories and have different contents: 1 (Src: 1 Dest: 1)
118118
"""
119119
),
@@ -129,11 +129,11 @@ def test_dcmp_different_symlink_target(self):
129129
proc,
130130
textwrap.dedent(
131131
"""
132-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
132+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
133133
Number of items that exist only in one directory: 0 (Src: 0 Dest: 0)
134-
Number of items that exist in both directories and have the same type: 9 (Src: 9 Dest: 9)
134+
Number of items that exist in both directories and have the same type: 12 (Src: 12 Dest: 12)
135135
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
136-
Number of items that exist in both directories and have the same content: 8 (Src: 8 Dest: 8)
136+
Number of items that exist in both directories and have the same content: 11 (Src: 11 Dest: 11)
137137
Number of items that exist in both directories and have different contents: 1 (Src: 1 Dest: 1)
138138
"""
139139
),
@@ -149,11 +149,11 @@ def test_dcmp_different_hardlink_target(self):
149149
proc,
150150
textwrap.dedent(
151151
"""
152-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
152+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
153153
Number of items that exist only in one directory: 0 (Src: 0 Dest: 0)
154-
Number of items that exist in both directories and have the same type: 9 (Src: 9 Dest: 9)
154+
Number of items that exist in both directories and have the same type: 12 (Src: 12 Dest: 12)
155155
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
156-
Number of items that exist in both directories and have the same content: 8 (Src: 8 Dest: 8)
156+
Number of items that exist in both directories and have the same content: 11 (Src: 11 Dest: 11)
157157
Number of items that exist in both directories and have different contents: 1 (Src: 1 Dest: 1)
158158
"""
159159
),
@@ -169,11 +169,11 @@ def test_dcmp_different_content(self):
169169
proc,
170170
textwrap.dedent(
171171
"""
172-
Number of items that exist in both directories: 9 (Src: 9 Dest: 9)
172+
Number of items that exist in both directories: 12 (Src: 12 Dest: 12)
173173
Number of items that exist only in one directory: 0 (Src: 0 Dest: 0)
174-
Number of items that exist in both directories and have the same type: 9 (Src: 9 Dest: 9)
174+
Number of items that exist in both directories and have the same type: 12 (Src: 12 Dest: 12)
175175
Number of items that exist in both directories and have different types: 0 (Src: 0 Dest: 0)
176-
Number of items that exist in both directories and have the same content: 8 (Src: 8 Dest: 8)
176+
Number of items that exist in both directories and have the same content: 11 (Src: 11 Dest: 11)
177177
Number of items that exist in both directories and have different contents: 1 (Src: 1 Dest: 1)
178178
"""
179179
),

test/tests/test_dcp.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ def test_dcp(self):
7777
proc,
7878
textwrap.dedent(
7979
"""
80-
Items: 9
80+
Items: 12
8181
Directories: 2
82-
Files: 4
82+
Files: 5
8383
Links: 2
84-
Hardlinks: 1
84+
Hardlinks: 3
8585
"""
8686
),
8787
)
@@ -150,11 +150,11 @@ def test_dcp_dwalk_input(self):
150150
proc,
151151
textwrap.dedent(
152152
"""
153-
Items: 9
153+
Items: 12
154154
Directories: 2
155-
Files: 4
155+
Files: 5
156156
Links: 2
157-
Hardlinks: 1
157+
Hardlinks: 3
158158
"""
159159
),
160160
)
@@ -168,11 +168,11 @@ def test_dcp_dwalk_input_lite(self):
168168
proc,
169169
textwrap.dedent(
170170
"""
171-
Items: 9
171+
Items: 12
172172
Directories: 2
173-
Files: 4
173+
Files: 5
174174
Links: 2
175-
Hardlinks: 1
175+
Hardlinks: 3
176176
"""
177177
),
178178
)
@@ -186,11 +186,11 @@ def test_dcp_dfind_input(self):
186186
proc,
187187
textwrap.dedent(
188188
"""
189-
Items: 9
189+
Items: 12
190190
Directories: 2
191-
Files: 4
191+
Files: 5
192192
Links: 2
193-
Hardlinks: 1
193+
Hardlinks: 3
194194
"""
195195
),
196196
)

test/tests/test_dsync.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def test_dsync_empty_dest(self):
5757
proc,
5858
textwrap.dedent(
5959
"""
60-
Items: 8
60+
Items: 11
6161
Directories: 1
62-
Files: 4
62+
Files: 5
6363
Links: 2
64-
Hardlinks: 1
64+
Hardlinks: 3
6565
"""
6666
),
6767
)
@@ -99,7 +99,7 @@ def test_dsync_remove_source(self):
9999
proc = self.run_dsync()
100100
self.assertInProcStdout(
101101
proc,
102-
"Comparing file sizes and modification times of 3 items",
102+
"Comparing file sizes and modification times of 4 items",
103103
)
104104
self.assertSrcDstEqual(ignore_paths=["file2"])
105105
self.assertFalse((self.src / "file2").exists())
@@ -127,11 +127,11 @@ def test_dsync_file_in_dst(self):
127127
proc,
128128
textwrap.dedent(
129129
"""
130-
Items: 8
130+
Items: 11
131131
Directories: 1
132-
Files: 4
132+
Files: 5
133133
Links: 2
134-
Hardlinks: 1
134+
Hardlinks: 3
135135
"""
136136
),
137137
)
@@ -220,16 +220,16 @@ def test_dsync_symlink_dereference_target_nlinks(self):
220220
(self.dst / "file3").stat().st_ino,
221221
)
222222

223-
# Check dsync reported creation of 2 hardlinks and 0 symlink.
223+
# Check dsync reported creation of 4 hardlinks and 0 symlink.
224224
self.assertInProcStdout(
225225
proc,
226226
textwrap.dedent(
227227
"""
228-
Items: 8
228+
Items: 11
229229
Directories: 1
230-
Files: 5
230+
Files: 6
231231
Links: 0
232-
Hardlinks: 2
232+
Hardlinks: 4
233233
"""
234234
),
235235
)
@@ -273,7 +273,7 @@ def test_dsync_sync_same_size_mtime(self):
273273
os.utime(self.src / "file2", ns=(previous_atime, previous_mtime))
274274
proc = self.run_dsync()
275275
self.assertInProcStdout(
276-
proc, "Comparing file sizes and modification times of 4 items"
276+
proc, "Comparing file sizes and modification times of 5 items"
277277
)
278278
# Check src/dst metadata are equal but file2 still contains first 64
279279
# random bytes.
@@ -331,7 +331,7 @@ def test_dsync_sync_same_size_mtime_contents(self):
331331
proc = self.run_dsync(contents=True)
332332
self.assertInProcStdout(
333333
proc,
334-
"Comparing file contents of 4 items",
334+
"Comparing file contents of 5 items",
335335
)
336336
# FIXME: mtime on file2 do not match on src/dst even though it has been
337337
# updated with second dsync.
@@ -378,11 +378,11 @@ def test_dsync_hardlink_outside_tree(self):
378378
proc,
379379
textwrap.dedent(
380380
"""
381-
Items: 8
381+
Items: 11
382382
Directories: 1
383-
Files: 5
383+
Files: 6
384384
Links: 2
385-
Hardlinks: 0
385+
Hardlinks: 2
386386
"""
387387
),
388388
)

0 commit comments

Comments
 (0)