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
cf473286
Commit
cf473286
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
tests
parent
4de95c6d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
coolamqp/clustering/single.py
+6
-0
6 additions, 0 deletions
coolamqp/clustering/single.py
tests/test_clustering/__init__.py
+8
-0
8 additions, 0 deletions
tests/test_clustering/__init__.py
tests/test_clustering/test_a.py
+34
-0
34 additions, 0 deletions
tests/test_clustering/test_a.py
with
48 additions
and
0 deletions
coolamqp/clustering/single.py
+
6
−
0
View file @
cf473286
...
...
@@ -19,6 +19,8 @@ class SingleNodeReconnector(object):
self
.
attache_group
=
attache_group
self
.
connection
=
None
self
.
terminating
=
False
def
is_connected
(
self
):
return
self
.
connection
is
not
None
...
...
@@ -32,11 +34,15 @@ class SingleNodeReconnector(object):
self
.
connection
.
add_finalizer
(
self
.
on_fail
)
def
on_fail
(
self
):
if
self
.
terminating
:
return
self
.
connection
=
None
self
.
connect
()
def
shutdown
(
self
):
"""
Close this connection
"""
self
.
terminating
=
True
if
self
.
connection
is
not
None
:
self
.
connection
.
send
(
None
)
self
.
connection
=
None
This diff is collapsed.
Click to expand it.
tests/test_clustering/__init__.py
0 → 100644
+
8
−
0
View file @
cf473286
# coding=UTF-8
from
__future__
import
print_function
,
absolute_import
,
division
import
six
import
logging
logger
=
logging
.
getLogger
(
__name__
)
This diff is collapsed.
Click to expand it.
tests/test_clustering/test_a.py
0 → 100644
+
34
−
0
View file @
cf473286
# coding=UTF-8
"""
Test things
"""
from
__future__
import
print_function
,
absolute_import
,
division
import
six
import
unittest
import
time
,
logging
,
threading
from
coolamqp.objects
import
Message
,
MessageProperties
,
NodeDefinition
,
Queue
from
coolamqp.clustering
import
Cluster
import
time
NODE
=
NodeDefinition
(
'
127.0.0.1
'
,
'
user
'
,
'
user
'
,
heartbeat
=
20
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
class
TestA
(
unittest
.
TestCase
):
def
test_link
(
self
):
"""
Connect and disconnect
"""
c
=
Cluster
([
NODE
])
c
.
start
()
c
.
shutdown
()
def
test_consume
(
self
):
c
=
Cluster
([
NODE
])
c
.
start
()
con
,
fut
=
c
.
consume
(
Queue
(
u
'
hello
'
,
exclusive
=
True
))
# fut.result()
con
.
cancel
()
c
.
shutdown
()
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