Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CaosDB Python Integration Tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Python Integration Tests
Commits
958d8995
Verified
Commit
958d8995
authored
Dec 2, 2022
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
TST: reenable consistency tests
parent
6b29e838
No related branches found
No related tags found
2 merge requests
!50
Draft: ENH: file system: core
,
!8
Draft: F filesystem
Pipeline
#31262
failed
Dec 2, 2022
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_file.py
+5
-45
5 additions, 45 deletions
tests/test_file.py
with
5 additions
and
45 deletions
tests/test_file.py
+
5
−
45
View file @
958d8995
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment