Skip to content

Commit

Permalink
Merge pull request #185 from felipehernandez/beta
Browse files Browse the repository at this point in the history
2.3
  • Loading branch information
felipehernandez authored May 20, 2022
2 parents 6501a32 + 36ae2e0 commit 93acd70
Show file tree
Hide file tree
Showing 19 changed files with 798 additions and 47 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ version: 2.1
parameters:
image-version:
type: string
default: "2.1"
default: "2.3"

orbs:
python: circleci/python@1.4.0
python: circleci/python@1.5.0

executors:
docker-builder:
Expand Down Expand Up @@ -118,9 +118,6 @@ workflows:
equal: [ main, << pipeline.git.branch >> ]
jobs:
- build
# - setup-integration-tests:
# requires:
# - build
- run-integration-tests:
matrix:
parameters:
Expand All @@ -146,6 +143,7 @@ workflows:
- zookeeper
- pubsub
- datastore
- rabbitmq
requires:
- build
- validate-integration-tests:
Expand Down Expand Up @@ -181,6 +179,7 @@ workflows:
- zookeeper
- pubsub
- datastore
- rabbitmq
requires:
- build
- validate-integration-tests:
Expand Down Expand Up @@ -226,6 +225,7 @@ workflows:
- zookeeper
- pubsub
- datastore
- rabbitmq
requires:
- build
- validate-integration-tests:
Expand Down
80 changes: 80 additions & 0 deletions .circleci/rabbitmq/definitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"queues": [
{
"name": "test-exchange-single.queue-single-1",
"vhost": "test",
"durable": true,
"auto_delete": false,
"arguments": {
"x-dead-letter-exchange": "DLX",
"x-dead-letter-routing-key": "test-exchange-single.queue-single-1"
}
},
{
"name": "test-exchange-multiple.queue-multiple-1",
"vhost": "test",
"durable": true,
"auto_delete": false,
"arguments": {
"x-dead-letter-exchange": "DLX",
"x-dead-letter-routing-key": "test-exchange-multiple.queue-multiple-1"
}
},
{
"name": "test-exchange-multiple.queue-multiple-2",
"vhost": "test",
"durable": true,
"auto_delete": false,
"arguments": {
"x-dead-letter-exchange": "DLX",
"x-dead-letter-routing-key": "test-exchange-multiple.queue-multiple-2"
}
}
],
"exchanges": [
{
"name": "test-exchange-single",
"vhost": "test",
"type": "topic",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
},
{
"name": "test-exchange-multiple",
"vhost": "test",
"type": "topic",
"durable": true,
"auto_delete": false,
"internal": false,
"arguments": {}
}
],
"bindings": [
{
"source": "test-exchange-single",
"vhost": "test",
"destination": "test-exchange-single.queue-single-1",
"destination_type": "queue",
"routing_key": "#",
"arguments": {}
},
{
"source": "test-exchange-multiple",
"vhost": "test",
"destination": "test-exchange-multiple.queue-multiple-1",
"destination_type": "queue",
"routing_key": "#",
"arguments": {}
},
{
"source": "test-exchange-multiple",
"vhost": "test",
"destination": "test-exchange-multiple.queue-multiple-2",
"destination_type": "queue",
"routing_key": "#",
"arguments": {}
}
]
}
1 change: 1 addition & 0 deletions .circleci/rabbitmq/rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
management.load_definitions = /etc/rabbitmq/definitions.json
2 changes: 1 addition & 1 deletion Dockerfile-integration
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim
FROM python:3.10-slim

WORKDIR /

Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ services:
depends_on:
- zookeeper

rabbitmq:
image: rabbitmq:3-management
environment:
RABBITMQ_DEFAULT_PASS: guest
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_VHOST: test
ports:
- 5672:5672
- 15672:15672
volumes:
- ./.circleci/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
- ./.circleci/rabbitmq/definitions.json:/etc/rabbitmq/definitions.json

integration-tests-template:
build:
context: .
Expand Down Expand Up @@ -201,3 +214,10 @@ services:
command: -t zookeeper -n 4 --trace
depends_on:
- zookeeper
integration-tests-rabbitmq:
build:
context: .
dockerfile: Dockerfile-integration
command: -t rabbitmq -n 2 --trace
depends_on:
- rabbitmq
43 changes: 43 additions & 0 deletions example/test/module/rabbitmq/test_dummy_rabbitmq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: RabbitMQ Test
description: Dummy Test for RabbitMQ Stage
tags:
- dummy
- rabbitmq

stages:
- name: setup
action:
type: VOID
save:
host: rabbitmq
# host: localhost
port: 5672
vhost: test

- name: publish message
action:
type: RABBITMQ
method: PUBLISH
host: ${host}
port: ${port}
vhost: ${vhost}
exchange: test-exchange-single
message: hello world
log:
- 'Elapsed time: ${elapsed_time}'

- name: subscribe
action:
type: RABBITMQ
method: SUBSCRIBE
host: ${host}
port: ${port}
vhost: ${vhost}
queue: test-exchange-single.queue-single-1
ack: True
log:
- 'Queue: ${queue}'
- 'Message: ${message}'
- 'Ack-ed: ${ack-ed}'
assert:
- ${message} == 'hello world'
59 changes: 59 additions & 0 deletions example/test/module/rabbitmq/test_multiple_queues_rabbitmq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: RabbitMQ multiple queues Test
description: Test for RabbitMQ Stage publishing to 1 and subscribing to multiple
tags:
- dummy
- rabbitmq

stages:
- name: setup
action:
type: VOID
save:
host: rabbitmq
# host: localhost
port: 5672
vhost: test

- name: publish message
action:
type: RABBITMQ
method: PUBLISH
host: ${host}
port: ${port}
vhost: ${vhost}
exchange: test-exchange-multiple
message: hello world
log:
- 'Elapsed time: ${elapsed_time}'

- name: subscribe 1
action:
type: RABBITMQ
method: SUBSCRIBE
host: ${host}
port: ${port}
vhost: ${vhost}
queue: test-exchange-multiple.queue-multiple-1
ack: True
log:
- 'Queue: ${queue}'
- 'Message: ${message}'
- 'Ack-ed: ${ack-ed}'
assert:
- ${message} == 'hello world'

- name: subscribe 2
action:
type: RABBITMQ
method: SUBSCRIBE
host: ${host}
port: ${port}
vhost: ${vhost}
queue: test-exchange-multiple.queue-multiple-2
ack: True
log:
- 'Queue: ${queue}'
- 'Message: ${message}'
- 'Ack-ed: ${ack-ed}'
assert:
- ${message} == 'hello world'
4 changes: 4 additions & 0 deletions folker/module/rabbitmq/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from folker.load.schemas import ActionSchema
from folker.module.rabbitmq.schema import RabbitMQActionSchema

ActionSchema.type_schemas['RABBITMQ'] = RabbitMQActionSchema
Loading

0 comments on commit 93acd70

Please sign in to comment.