Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joanne Hugé
slapos.toolbox
Commits
61f7e71c
Commit
61f7e71c
authored
May 15, 2020
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_equeue: correctly encode/decode when using socket
As python3 only accept binary types for sockets
parent
4035fe5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
slapos/test/test_equeue.py
slapos/test/test_equeue.py
+6
-6
No files found.
slapos/test/test_equeue.py
View file @
61f7e71c
...
...
@@ -78,9 +78,9 @@ class TestEqueue(unittest.TestCase):
for
request
in
(
request_1
,
request_2
):
equeue_socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
equeue_socket
.
connect
(
self
.
socket
)
equeue_socket
.
send
(
json
.
dumps
(
request
))
equeue_socket
.
send
(
json
.
dumps
(
request
)
.
encode
()
)
result
=
equeue_socket
.
recv
(
1024
)
self
.
assertEqual
(
result
,
request
[
'command'
])
self
.
assertEqual
(
result
.
decode
()
,
request
[
'command'
])
equeue_socket
.
close
()
# Wait for the 1st command to finish
...
...
@@ -113,9 +113,9 @@ class TestEqueue(unittest.TestCase):
for
request
in
(
request_1
,
request_2
):
equeue_socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
equeue_socket
.
connect
(
self
.
socket
)
equeue_socket
.
send
(
json
.
dumps
(
request
))
equeue_socket
.
send
(
json
.
dumps
(
request
)
.
encode
()
)
result
=
equeue_socket
.
recv
(
1024
)
self
.
assertEqual
(
result
,
request
[
'command'
])
self
.
assertEqual
(
result
.
decode
()
,
request
[
'command'
])
equeue_socket
.
close
()
# Give a bit of time for command to run
...
...
@@ -144,9 +144,9 @@ class TestEqueue(unittest.TestCase):
}
equeue_socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
equeue_socket
.
connect
(
self
.
socket
)
equeue_socket
.
send
(
json
.
dumps
(
request
))
equeue_socket
.
send
(
json
.
dumps
(
request
)
.
encode
()
)
result
=
equeue_socket
.
recv
(
1024
)
self
.
assertEqual
(
result
,
request
[
'command'
])
self
.
assertEqual
(
result
.
decode
()
,
request
[
'command'
])
equeue_socket
.
close
()
# Give a bit of time for command to run
...
...
Write
Preview
Markdown
is supported
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