Skip to content
Snippets Groups Projects
Verified Commit 958d8995 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

TST: reenable consistency tests

parent 6b29e838
No related branches found
No related tags found
2 merge requests!50Draft: ENH: file system: core,!8Draft: F filesystem
Pipeline #31262 failed
...@@ -95,7 +95,6 @@ def test_file_with_space(): ...@@ -95,7 +95,6 @@ def test_file_with_space():
qfile.download("test2.dat") qfile.download("test2.dat")
@mark.xfail(reason="implementation is missing")
def test_consistency_file_does_not_exist(): def test_consistency_file_does_not_exist():
with open("test.dat", "w") as upload_file: with open("test.dat", "w") as upload_file:
upload_file.write("hello world\n") upload_file.write("hello world\n")
...@@ -121,7 +120,7 @@ def test_consistency_file_does_not_exist(): ...@@ -121,7 +120,7 @@ def test_consistency_file_does_not_exist():
c = runCheck(None, "-c FILE_DOES_NOT_EXIST") c = runCheck(None, "-c FILE_DOES_NOT_EXIST")
assert c.messages["Error", 0] is not None assert c.messages["Error", 0] is not None
assert c.messages["Error", assert c.messages["Error",
0][0] == 'debug/test_file_storage_consistency: File does not exist.' 0][0] == 'MISSING - DEFAULT:debug/test_file_storage_consistency'
with open(file_.download(target="test.dat.tmp"), "r") as d: with open(file_.download(target="test.dat.tmp"), "r") as d:
r = d.read() r = d.read()
...@@ -132,7 +131,6 @@ def test_consistency_file_does_not_exist(): ...@@ -132,7 +131,6 @@ def test_consistency_file_does_not_exist():
assert c.messages["Info", 0][0] == "File system is consistent." assert c.messages["Info", 0][0] == "File system is consistent."
@mark.xfail(reason="implementation is missing")
def test_consistency_file_was_modified(): def test_consistency_file_was_modified():
# insert new test file # insert new test file
with open("test.dat", "w") as upload_file: with open("test.dat", "w") as upload_file:
...@@ -160,7 +158,7 @@ def test_consistency_file_was_modified(): ...@@ -160,7 +158,7 @@ def test_consistency_file_was_modified():
assert c.messages["Error", 0] is not None assert c.messages["Error", 0] is not None
assert c.messages["Error", assert c.messages["Error",
0][0] == 'debug/test_file_storage_consistency: File was modified.' 0][0] == 'CHANGED:HASH - DEFAULT:debug/test_file_storage_consistency'
# download file again and check if it is still the same (just to be # download file again and check if it is still the same (just to be
# sure that the server only simulated the consistency breach # sure that the server only simulated the consistency breach
...@@ -174,44 +172,6 @@ def test_consistency_file_was_modified(): ...@@ -174,44 +172,6 @@ def test_consistency_file_was_modified():
assert c.messages["Info", 0][0] == "File system is consistent." assert c.messages["Info", 0][0] == "File system is consistent."
@mark.xfail(reason="implementation is missing")
def test_consistency_file_does_not_exist():
with open("test.dat", "w") as upload_file:
upload_file.write("hello world\n")
file_ = models.File(name="TestConsistency2",
description="Testfile Desc",
path="debug/test_file_storage_consistency",
file="test.dat")
file_.insert()
assert file_.id is not None
assert file_.is_valid()
c = runCheck(None, "/debug/")
assert c.messages["Info", 0] is not None
assert c.messages["Info",
0][0] == "File system below debug/ is consistent."
# when in debug mode, the server offers a special option
#
# '-c FILE_DOES_NOT_EXIST'
#
# which simulates a accidentially removed file.
c = runCheck(None, "-c FILE_DOES_NOT_EXIST")
assert c.messages["Error", 0] is not None
assert c.messages["Error",
0][0] == 'debug/test_file_storage_consistency: File does not exist.'
with open(file_.download(target="test.dat.tmp"), "r") as d:
r = d.read()
assert r == "hello world\n"
c = runCheck(None, None)
assert c.messages["Info", 0] is not None
assert c.messages["Info", 0][0] == "File system is consistent."
@mark.xfail(reason="implementation is missins")
def test_consistency_unknown_file(): def test_consistency_unknown_file():
c = runCheck(None, None) c = runCheck(None, None)
assert c.messages["Info", 0] is not None assert c.messages["Info", 0] is not None
...@@ -225,7 +185,7 @@ def test_consistency_unknown_file(): ...@@ -225,7 +185,7 @@ def test_consistency_unknown_file():
c = runCheck(None, "-c UNKNOWN_FILE") c = runCheck(None, "-c UNKNOWN_FILE")
assert c.messages["Warning", 0] is not None assert c.messages["Warning", 0] is not None
assert c.messages["Warning", assert c.messages["Warning",
0][0] == 'debug/: Unknown file.' 0][0] == 'UNKNOWN - DEFAULT:debug'
c = runCheck(None, None) c = runCheck(None, None)
assert c.messages["Info", 0] is not None assert c.messages["Info", 0] is not None
...@@ -310,7 +270,6 @@ def test_auto_create_parent_dirs(): ...@@ -310,7 +270,6 @@ def test_auto_create_parent_dirs():
assert file_1.get("url")[-26:] == "/FileSystem/A/B/C/test.dat" assert file_1.get("url")[-26:] == "/FileSystem/A/B/C/test.dat"
@mark.xfail(reason="implementation is missing")
def test_consistency_file_was_modified_2(): def test_consistency_file_was_modified_2():
# this test is different from test_consistency_file_was_modified in that # this test is different from test_consistency_file_was_modified in that
# the server does actually corrupt the file. # the server does actually corrupt the file.
...@@ -344,7 +303,7 @@ def test_consistency_file_was_modified_2(): ...@@ -344,7 +303,7 @@ def test_consistency_file_was_modified_2():
assert c.messages["Error", 0] is not None assert c.messages["Error", 0] is not None
assert c.messages["Error", assert c.messages["Error",
0][0] == 'debug/test_file_storage_consistency: File was modified.' 0][0] == 'CHANGED:HASH - DEFAULT:debug/test_file_storage_consistency'
# old checksum is still stored # old checksum is still stored
qfile = execute_query("FIND FILE TestConsistency3", unique=True) qfile = execute_query("FIND FILE TestConsistency3", unique=True)
...@@ -368,6 +327,7 @@ def test_consistency_file_was_modified_2(): ...@@ -368,6 +327,7 @@ def test_consistency_file_was_modified_2():
# here the client may validate the new file # here the client may validate the new file
file_.file = None file_.file = None
file_.size = None
file_.update() file_.update()
assert checksum2 == file_.checksum.lower() assert checksum2 == file_.checksum.lower()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment