Skip to content

Commit 34e90f1

Browse files
committed
symlink test
1 parent 1bbe3a5 commit 34e90f1

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

yas3fs-test/002_basic_single_file.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def test_write_empty_file_a():
3535
assert_equals(local_stat.st_uid, 0)
3636
assert_equals(local_stat.st_gid, 0)
3737

38+
time.sleep(1)
39+
3840
# what does boto say?
3941
k = settings.mount['a']['conn_bucket'].get_key(s3_file)
4042
s3_stat = json.loads(k.metadata['attr'])
@@ -262,3 +264,36 @@ def test_make_directory_a():
262264
local_b_stat = os.stat(local_b_file)
263265
assert_equals(os.path.exists(local_b_file), True)
264266

267+
def test_create_sym_link_a():
268+
269+
src_fname = "/etc/passwd"
270+
271+
fname = "/passwd_sym_link"
272+
local_file = settings.mount['a']['local_path'] + fname
273+
local_b_file = settings.mount['b']['local_path'] + fname
274+
s3_file = settings.mount['a']['s3_path'] + fname
275+
276+
p = Popen("ln -s " + src_fname + " " + local_file, shell=True)
277+
p.communicate()
278+
279+
src_stat = os.stat(src_fname)
280+
281+
# can i access it locally?
282+
local_stat = os.stat(local_file)
283+
assert_equals(local_stat.st_size, src_stat.st_size)
284+
285+
# takes 1 second to catch up?!
286+
time.sleep(1)
287+
288+
# what does boto say?
289+
k = settings.mount['a']['conn_bucket'].get_key(s3_file)
290+
s3_stat = json.loads(k.metadata['attr'])
291+
assert_equals(k.size, len(src_fname))
292+
assert_equals(s3_stat['st_size'], 0)
293+
assert_equals(s3_stat['st_uid'], 0)
294+
assert_equals(s3_stat['st_gid'], 0)
295+
296+
# can the other mount see it?
297+
local_b_stat = os.stat(local_b_file)
298+
assert_equals(local_b_stat.st_size, src_stat.st_size)
299+

yas3fs-test/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.0.0'

0 commit comments

Comments
 (0)