Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
agkyra
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
agkyra
Commits
6b953da8
Commit
6b953da8
authored
9 years ago
by
Giorgos Korfiatis
Browse files
Options
Downloads
Patches
Plain Diff
Started test
parent
3d594fbd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
agkyra/agkyra/config.py
+2
-1
2 additions, 1 deletion
agkyra/agkyra/config.py
agkyra/test.py
+127
-0
127 additions, 0 deletions
agkyra/test.py
with
129 additions
and
1 deletion
agkyra/agkyra/config.py
+
2
−
1
View file @
6b953da8
...
...
@@ -24,7 +24,8 @@ from kamaki.cli.utils import escape_ctrl_chars
CLOUD_PREFIX
=
config
.
CLOUD_PREFIX
config
.
HEADER
=
'
# Agkyra configuration file version XXX
\n
'
AGKYRA_DIR
=
os
.
environ
.
get
(
'
AGKYRA_DIR
'
,
os
.
path
.
expanduser
(
'
~/.agkyra
'
))
config
.
CONFIG_PATH
=
'
%s%sconfig.rc
'
%
(
AGKYRA_DIR
,
os
.
path
.
sep
)
CONFIG_PATH
=
'
%s%sconfig.rc
'
%
(
AGKYRA_DIR
,
os
.
path
.
sep
)
config
.
CONFIG_PATH
=
CONFIG_PATH
# neutralize kamaki CONFIG_ENV for this session
config
.
CONFIG_ENV
=
''
...
...
This diff is collapsed.
Click to expand it.
agkyra/test.py
0 → 100644
+
127
−
0
View file @
6b953da8
from
agkyra.syncer.setup
import
SyncerSettings
from
agkyra.syncer.localfs_client
import
LocalfsFileClient
from
agkyra.syncer.pithos_client
import
PithosFileClient
from
agkyra.syncer.syncer
import
FileSyncer
from
agkyra.syncer
import
messaging
,
utils
import
random
from
agkyra.config
import
AgkyraConfig
,
CONFIG_PATH
cnf
=
AgkyraConfig
()
cloud_conf
=
cnf
.
get
(
'
cloud
'
,
'
test
'
)
if
cloud_conf
is
None
:
print
"
Define a
'
test
'
cloud in %s
"
%
CONFIG_PATH
exit
()
AUTHENTICATION_URL
=
cloud_conf
[
'
url
'
]
TOKEN
=
cloud_conf
[
'
token
'
]
ID
=
"
AGKYRATEST
"
+
str
(
random
.
random
()).
split
(
'
.
'
)[
1
]
LOCAL_ROOT_PATH
=
"
/tmp/
"
+
ID
settings
=
SyncerSettings
(
instance
=
ID
,
auth_url
=
AUTHENTICATION_URL
,
auth_token
=
TOKEN
,
container
=
ID
,
local_root_path
=
LOCAL_ROOT_PATH
,
ignore_ssl
=
True
)
master
=
PithosFileClient
(
settings
)
slave
=
LocalfsFileClient
(
settings
)
s
=
FileSyncer
(
settings
,
master
,
slave
)
pithos
=
master
.
endpoint
pithos
.
create_container
(
ID
)
f1
=
"
f1
"
content1
=
"
content1
"
r1
=
pithos
.
upload_from_string
(
f1
,
content1
)
etag1
=
r1
[
'
etag
'
]
pithos_cands
=
master
.
get_pithos_candidates
()
info
=
pithos_cands
[
f1
]
assert
etag1
==
info
[
"
pithos_etag
"
]
db
=
s
.
get_db
()
state
=
db
.
get_state
(
master
.
SIGNATURE
,
f1
)
assert
state
.
serial
==
-
1
assert
state
.
info
==
{}
s
.
probe_file
(
master
.
SIGNATURE
,
f1
)
m
=
s
.
get_next_message
(
block
=
True
)
assert
isinstance
(
m
,
messaging
.
UpdateMessage
)
state
=
db
.
get_state
(
master
.
SIGNATURE
,
f1
)
assert
state
.
serial
==
0
assert
state
.
info
==
info
deciding
=
s
.
list_deciding
()
assert
deciding
==
set
([
f1
])
state
=
db
.
get_state
(
slave
.
SIGNATURE
,
f1
)
assert
state
.
serial
==
-
1
assert
state
.
info
==
{}
s
.
decide_file_sync
(
f1
)
m
=
s
.
get_next_message
(
block
=
True
)
assert
isinstance
(
m
,
messaging
.
SyncMessage
)
m
=
s
.
get_next_message
(
block
=
True
)
assert
isinstance
(
m
,
messaging
.
AckSyncMessage
)
state
=
db
.
get_state
(
slave
.
SIGNATURE
,
f1
)
assert
state
.
serial
==
0
info
=
state
.
info
assert
info
[
'
localfs_size
'
]
==
len
(
content1
)
local_path
=
LOCAL_ROOT_PATH
+
'
/
'
+
f1
assert
utils
.
hash_file
(
local_path
)
==
utils
.
hash_string
(
content1
)
def
write_local
():
content2
=
"
content2
"
with
open
(
local_path
,
"
w
"
)
as
f
:
f
.
write
(
content2
)
def
write_upstream
():
content3
=
"
content3
"
r3
=
pithos
.
upload_from_string
(
f1
,
content3
)
etag3
=
r1
[
'
etag
'
]
def
func
():
write_upstream
()
write_local
()
assert
s
.
get_next_message
()
is
None
s
.
initiate_probe
()
s
.
start_decide
()
m
=
s
.
get_next_message
(
block
=
True
)
print
m
assert
isinstance
(
m
,
messaging
.
UpdateMessage
)
assert
m
.
archive
==
master
.
SIGNATURE
m
=
s
.
get_next_message
(
block
=
True
)
print
m
assert
isinstance
(
m
,
messaging
.
UpdateMessage
)
assert
m
.
archive
==
slave
.
SIGNATURE
m
=
s
.
get_next_message
(
block
=
True
)
print
m
assert
isinstance
(
m
,
messaging
.
SyncMessage
)
m
=
s
.
get_next_message
(
block
=
True
)
print
m
assert
isinstance
(
m
,
messaging
.
ConflictStashMessage
)
m
=
s
.
get_next_message
(
block
=
True
)
print
m
assert
isinstance
(
m
,
messaging
.
AckSyncMessage
)
func
()
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