Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
11aec527
Commit
11aec527
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
passes
parent
45d9e0e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coolamqp/handler.py
+2
-1
2 additions, 1 deletion
coolamqp/handler.py
tests/test_cluster.py
+18
-0
18 additions, 0 deletions
tests/test_cluster.py
with
20 additions
and
1 deletion
coolamqp/handler.py
+
2
−
1
View file @
11aec527
#coding=UTF-8
#coding=UTF-8
import
threading
import
threading
import
six.moves.queue
as
Queue
import
six.moves.queue
as
Queue
import
six
import
logging
import
logging
import
collections
import
collections
import
time
import
time
...
@@ -47,7 +48,7 @@ class ClusterHandlerThread(threading.Thread):
...
@@ -47,7 +48,7 @@ class ClusterHandlerThread(threading.Thread):
self
.
backend
=
None
self
.
backend
=
None
self
.
connect_id
+=
1
self
.
connect_id
+=
1
node
=
self
.
cluster
.
node_to_connect_to
.
next
(
)
node
=
six
.
next
(
self
.
cluster
.
node_to_connect_to
)
logger
.
info
(
'
Connecting to %s
'
,
node
)
logger
.
info
(
'
Connecting to %s
'
,
node
)
try
:
try
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_cluster.py
+
18
−
0
View file @
11aec527
...
@@ -15,6 +15,24 @@ class MyTestCase(unittest.TestCase):
...
@@ -15,6 +15,24 @@ class MyTestCase(unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
self
.
amqp
.
shutdown
()
self
.
amqp
.
shutdown
()
def
test_nacknowledge
(
self
):
myq
=
Queue
(
'
myqueue
'
,
exclusive
=
True
)
self
.
amqp
.
consume
(
myq
)
self
.
amqp
.
send
(
Message
(
b
'
what the fuck
'
),
''
,
routing_key
=
'
myqueue
'
)
p
=
self
.
amqp
.
drain
(
wait
=
10
)
self
.
assertIsInstance
(
p
,
MessageReceived
)
self
.
assertEquals
(
p
.
message
.
body
,
b
'
what the fuck
'
)
p
.
message
.
nack
()
p
=
self
.
amqp
.
drain
(
wait
=
10
)
self
.
assertIsInstance
(
p
,
MessageReceived
)
self
.
assertEquals
(
p
.
message
.
body
,
b
'
what the fuck
'
)
self
.
amqp
.
delete_queue
(
myq
)
def
test_send_and_receive
(
self
):
def
test_send_and_receive
(
self
):
myq
=
Queue
(
'
myqueue
'
,
exclusive
=
True
)
myq
=
Queue
(
'
myqueue
'
,
exclusive
=
True
)
...
...
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