Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ flake8: requirements .flake8
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "setuptools==$(SETUPTOOLS_VERSION)"

$(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; ../$(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd ..
$(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; ../$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install -e .; cd ..
$(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version
$(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client"

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ orquesta@ git+https://github.com/StackStorm/orquesta.git@5ba1467614b2ef8b4709b2c
oslo.config==9.6.0
oslo.utils==7.3.0
paramiko==3.5.1
ply
prettytable==3.10.2
prompt-toolkit==3.0.52
psutil==7.0.0
Expand Down
1 change: 1 addition & 0 deletions st2client/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ importlib-metadata==7.1.0
jsonpath-rw==1.4.0
jsonschema==3.2.0
orjson==3.10.15
ply
prettytable==3.10.2
prompt-toolkit==3.0.52
pyOpenSSL
Expand Down
24 changes: 23 additions & 1 deletion st2reactor/tests/integration/test_sensor_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ def setUpClass(cls):
def setUp(self):
super().setUp()
# pre-condition: Make sure there is no test pollution
# Delete any leftover queues from previous failed test runs
self._delete_sensor_watcher_amqp_queues(queue_name="st2.sensor.watch.covfefe")

# Verify queues are deleted
sw_queues = self._get_sensor_watcher_amqp_queues(
queue_name="st2.sensor.watch.covfefe"
)
# TODO: Maybe just delete any leftover queues from previous failed test runs.
self.assertTrue(len(sw_queues) == 0)

def test_sensor_watch_queue_gets_deleted_on_stop(self):
Expand Down Expand Up @@ -82,3 +85,22 @@ def _list_amqp_queues():
def _get_sensor_watcher_amqp_queues(self, queue_name):
all_queues = self._list_amqp_queues()
return set([q_name for q_name in all_queues if queue_name in q_name])

def _delete_sensor_watcher_amqp_queues(self, queue_name):
"""
Delete all queues containing the specified queue_name pattern.

:param string queue_name: Pattern to match in queue names
:returns: None
"""
# Get all queues matching the pattern
queues_to_delete = self._get_sensor_watcher_amqp_queues(queue_name=queue_name)

if not queues_to_delete:
return

# Create a rabbit client and delete each queue
rabbit_client = Client("localhost:15672", "guest", "guest")
for queue in queues_to_delete:
# Use default vhost "/"
rabbit_client.delete_queue("/", queue)
Loading