Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
prozorro-sale
Mirror
Commits
61e76da6
Commit
61e76da6
authored
Dec 29, 2021
by
Pavel Kuzmenko
Browse files
Merge branch 'zamirets/52/add-more-logs' into 'master'
Add more logs during operations See merge request
!184
parents
c2194aac
626064ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mongodb_mirror/client.py
View file @
61e76da6
...
...
@@ -98,6 +98,7 @@ class SocketMirrorClientSimpleProtocol(BaseSocketMirrorClient):
return
response_data
[
'data'
]
async
def
upsert
(
self
,
ts
,
data
):
LOG
.
info
(
f
"Upsert operation for object id:
{
data
[
'_id'
]
}
, timestamp:
{
ts
}
"
)
await
self
.
ws
.
send_json
({
'type'
:
'upsert'
,
'data'
:
data
,
...
...
@@ -141,6 +142,7 @@ class SocketMirrorClientFullProtocol(SocketMirrorClientSimpleProtocol):
"""
async
def
update
(
self
,
ts
,
data
):
LOG
.
info
(
f
"Update operation for object id:
{
data
[
'_id'
]
}
, timestamp:
{
ts
}
"
)
await
self
.
ws
.
send_json
({
'type'
:
'update'
,
'data'
:
data
,
...
...
@@ -148,6 +150,7 @@ class SocketMirrorClientFullProtocol(SocketMirrorClientSimpleProtocol):
},
dumps
=
ujson
.
dumps
)
async
def
delete
(
self
,
ts
,
data
):
LOG
.
info
(
f
"Delete operation for object id:
{
data
[
'_id'
]
}
, timestamp:
{
ts
}
"
)
await
self
.
ws
.
send_json
({
'type'
:
'delete'
,
'data'
:
data
,
...
...
test/unit/test_client.py
View file @
61e76da6
...
...
@@ -110,10 +110,10 @@ class TestSocketMirrorClientSimpleProtocol:
test_ws
.
send_json
=
AsyncMock
()
test_client
=
SocketMirrorClientSimpleProtocol
(
ws
=
test_ws
,
namespace
=
'test'
)
ts
=
timestamp
.
Timestamp
(
12345
,
1
)
await
test_client
.
upsert
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
})
await
test_client
.
upsert
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
})
test_ws
.
send_json
.
assert_called_once_with
({
'type'
:
'upsert'
,
'data'
:
{
'msg'
:
'test'
},
'data'
:
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
},
'ts'
:
ts
},
dumps
=
ujson
.
dumps
)
...
...
@@ -137,10 +137,10 @@ class TestSocketMirrorClientFullProtocol:
test_ws
.
send_json
=
AsyncMock
()
test_client
=
SocketMirrorClientFullProtocol
(
ws
=
test_ws
,
namespace
=
'test'
)
ts
=
timestamp
.
Timestamp
(
12345
,
1
)
await
test_client
.
update
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
})
await
test_client
.
update
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
})
test_ws
.
send_json
.
assert_called_once_with
({
'type'
:
'update'
,
'data'
:
{
'msg'
:
'test'
},
'data'
:
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
},
'ts'
:
ts
},
dumps
=
ujson
.
dumps
)
...
...
@@ -149,10 +149,10 @@ class TestSocketMirrorClientFullProtocol:
test_ws
.
send_json
=
AsyncMock
()
test_client
=
SocketMirrorClientFullProtocol
(
ws
=
test_ws
,
namespace
=
'test'
)
ts
=
timestamp
.
Timestamp
(
12345
,
1
)
await
test_client
.
delete
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
})
await
test_client
.
delete
(
ts
=
ts
,
data
=
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
})
test_ws
.
send_json
.
assert_called_once_with
({
'type'
:
'delete'
,
'data'
:
{
'msg'
:
'test'
},
'data'
:
{
'msg'
:
'test'
,
'_id'
:
'61cb302a8bf859b605514445'
},
'ts'
:
ts
},
dumps
=
ujson
.
dumps
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment