Skip to content

Commit

Permalink
Add rabbitmq_stomp to bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloRin committed Apr 14, 2021
1 parent 011a907 commit e4aceb5
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 17 deletions.
2 changes: 0 additions & 2 deletions deps/rabbitmq_jms_topic_exchange/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load(
"@bazel-erlang//:bazel_erlang_lib.bzl",
"DEFAULT_TEST_ERLC_OPTS",
"erlang_lib",
"erlc",
"test_erlang_lib",
)
load("@bazel-erlang//:ct.bzl", "ct_suite")
Expand Down
326 changes: 317 additions & 9 deletions deps/rabbitmq_stomp/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
load("//:rabbitmq.bzl", "APP_VERSION", "RABBITMQ_ERLC_OPTS", "rabbitmq_lib")
load(
"@bazel-erlang//:bazel_erlang_lib.bzl",
"erlang_lib",
"erlc",
"test_erlang_lib",
)
load("@bazel-erlang//:ct.bzl", "ct_suite")
load("//:rabbitmq_home.bzl", "rabbitmq_home")
load("//:rabbitmq_run.bzl", "rabbitmq_run")
load(
"//:rabbitmq.bzl",
"APP_VERSION",
"RABBITMQ_ERLC_OPTS",
"RABBITMQ_TEST_ERLC_OPTS",
)

APP_NAME = "rabbitmq_stomp"

APP_DESCRIPTION = "RabbitMQ STOMP plugin"

APP_MODULE = "rabbit_stomp"

APP_ENV = """[
{default_user,
Expand All @@ -22,21 +42,309 @@ APP_ENV = """[
{proxy_protocol, false}
]"""

BUILD_DEPS = [
"//deps/rabbitmq_cli:rabbitmqctl",
]

DEPS = [
"@ranch//:bazel_erlang_lib",
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
"@ranch//:bazel_erlang_lib",
]

RUNTIME_DEPS = [
"//deps/rabbit:bazel_erlang_lib",
"//deps/amqp_client:bazel_erlang_lib",
]

rabbitmq_lib(
app_description = "RabbitMQ STOMP plugin",
erlang_lib(
app_description = APP_DESCRIPTION,
app_env = APP_ENV,
app_module = APP_MODULE,
app_name = APP_NAME,
app_version = APP_VERSION,
build_deps = BUILD_DEPS,
erlc_opts = RABBITMQ_ERLC_OPTS,
runtime_deps = RUNTIME_DEPS,
deps = DEPS,
)

test_erlang_lib(
app_description = APP_DESCRIPTION,
app_env = APP_ENV,
app_module = "rabbit_stomp",
app_name = "rabbitmq_stomp",
app_module = APP_MODULE,
app_name = APP_NAME,
app_version = APP_VERSION,
build_deps = [
build_deps = BUILD_DEPS,
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
runtime_deps = RUNTIME_DEPS,
deps = DEPS,
)

rabbitmq_home(
name = "broker-for-tests-home",
plugins = [
"//deps/rabbit:bazel_erlang_lib",
":bazel_erlang_lib",
],
)

rabbitmq_run(
name = "rabbitmq-for-tests-run",
home = ":broker-for-tests-home",
)

erlc(
name = "rabbit_stomp_client",
testonly = True,
srcs = [
"test/src/rabbit_stomp_client.erl",
],
hdrs = glob([
"include/**/*.hrl",
"src/**/*.hrl",
]),
deps = [
":test_bazel_erlang_lib",
],
)

ct_suite(
name = "command_SUITE",
size = "small",
additional_beam = [
":rabbit_stomp_client",
],
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
)

ct_suite(
name = "config_schema_SUITE",
size = "small",
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_client_helpers//:bazel_erlang_lib",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
)

ct_suite(
name = "connections_SUITE",
additional_beam = [
":rabbit_stomp_client",
],
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
)

ct_suite(
name = "frame_SUITE",
size = "small",
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
},
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
)

ct_suite(
name = "proxy_protocol_SUITE",
size = "small",
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_client_helpers//:bazel_erlang_lib",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
)

ct_suite(
name = "python_SUITE",
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
groups = [
"tls",
"implicit_connect",
"main",
],
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
)

ct_suite(
name = "system_SUITE",
size = "small",
additional_beam = [
":rabbit_stomp_client",
],
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
)

ct_suite(
name = "topic_SUITE",
size = "small",
additional_beam = [
":rabbit_stomp_client",
],
data = [
"@rabbitmq_ct_helpers//tools/tls-certs:Makefile",
"@rabbitmq_ct_helpers//tools/tls-certs:openssl.cnf.in",
],
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"SKIP_MAKE_TEST_DIST": "true",
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
"RABBITMQ_RUN": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/rabbitmq-for-tests-run",
"RABBITMQCTL": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmqctl",
"RABBITMQ_PLUGINS": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-plugins",
"RABBITMQ_QUEUES": "$TEST_SRCDIR/$TEST_WORKSPACE/deps/rabbitmq_stomp/broker-for-tests-home/sbin/rabbitmq-queues",
},
tools = [
":rabbitmq-for-tests-run",
],
runtime_deps = [
"//deps/rabbitmq_cli:elixir_as_bazel_erlang_lib",
"//deps/rabbitmq_cli:rabbitmqctl",
"@rabbitmq_ct_helpers//:bazel_erlang_lib",
],
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
)

ct_suite(
name = "util_SUITE",
size = "small",
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
test_env = {
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
},
deps = [
"//deps/amqp_client:bazel_erlang_lib",
"//deps/rabbit_common:bazel_erlang_lib",
],
deps = DEPS,
)
13 changes: 7 additions & 6 deletions deps/rabbitmq_stomp/test/python_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ run(Config, Test) ->
StompPortTls = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_stomp_tls),
AmqpPort = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_amqp),
NodeName = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
PythonPath = os:getenv("PYTHONPATH"),
os:putenv("PYTHONPATH", filename:join([DataDir, "deps", "pika","pika"])
++":"++
filename:join([DataDir, "deps", "stomppy", "stomppy"])
++ ":" ++
PythonPath),
PikaPath = filename:join([DataDir, "deps", "pika","pika"]),
StomppyPath = filename:join([DataDir, "deps", "stomppy", "stomppy"]),
PythonPath = case os:getenv("PYTHONPATH") of
false -> PikaPath ++ ":" ++ StomppyPath;
P -> PikaPath ++ ":" ++ StomppyPath ++ ":" ++ P
end,
os:putenv("PYTHONPATH", PythonPath),
os:putenv("AMQP_PORT", integer_to_list(AmqpPort)),
os:putenv("STOMP_PORT", integer_to_list(StompPort)),
os:putenv("STOMP_PORT_TLS", integer_to_list(StompPortTls)),
Expand Down

0 comments on commit e4aceb5

Please sign in to comment.