Skip to content

Commit 8c0eece

Browse files
committed
Adjustments for the latest bazel-erlang
1 parent 1037242 commit 8c0eece

File tree

10 files changed

+17
-22
lines changed

10 files changed

+17
-22
lines changed

BAZEL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Create a `user.bazelrc` by making a copy of `user-template.bazelrc` and updating
3535

3636
### Running tests
3737

38-
Many rabbit tests spawn single or clustered rabbit nodes, and therefore it's best to run test suites sequentially on a single machine. Hence the `build --local_test_jobs=1` flag used in `.bazelrc`. Additionally, it may be reasonable to disable test sharding and stream test output when running tests locally with `--test_sharding_strategy=disabled` & `--test_output=streamed` additional arguments. Naturally that restriction does not hold if utilizing remote execution (as is the case for RabbitMQ's CI pipelines).
38+
Many rabbit tests spawn single or clustered rabbit nodes, and therefore it's best to run test suites sequentially on a single machine. Hence the `build --local_test_jobs=1` flag used in `.bazelrc`. Additionally, it may be reasonable to disable test sharding and stream test output when running tests locally with `--test_output=streamed` as an additional argument (to just disable sharding, but not stream output, use `--test_sharding_strategy=disabled`). Naturally that restriction does not hold if utilizing remote execution (as is the case for RabbitMQ's CI pipelines).
3939

4040
Erlang Common Test logs will not be placed in the logs directory when run with bazel. They can be found under `bazel-testlogs`. For instance, those of the rabbit application's backing_queue suite will be under `bazel-testlogs/deps/rabbit/backing_queue_SUITE/test.outputs/`.
4141

deps/rabbitmq_cli/rabbitmqctl.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _impl(ctx):
131131
deps = flat_deps(ctx.attr.deps)
132132

133133
runfiles = ctx.runfiles([ebin])
134-
for dep in ctx.attr.deps:
134+
for dep in deps:
135135
runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles)
136136

137137
return [

deps/rabbitmq_ct_helpers/BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ erlang_lib(
77
"@proper//:bazel_erlang_lib",
88
"//deps/rabbit_common:bazel_erlang_lib",
99
],
10+
extra_priv = [
11+
"tools/tls-certs/Makefile",
12+
"tools/tls-certs/openssl.cnf.in",
13+
],
1014
)

deps/rabbitmq_ct_helpers/src/rabbit_ct_helpers.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,9 @@ load_rabbitmqctl_app(Config) ->
482482
Config;
483483
{error, {already_loaded, rabbitmqctl}} ->
484484
Config;
485-
{error, _} ->
485+
{error, Reason} ->
486+
ct:pal(?LOW_IMPORTANCE,
487+
"Failed to load rabbitmqctl application: ~p", [Reason]),
486488
{skip, "Application rabbitmqctl could not be loaded, " ++
487489
"please place compiled rabbitmq_cli on the code path"}
488490
end.

deps/rabbitmq_ct_helpers/tools/tls-certs/BUILD.bazel

Lines changed: 0 additions & 4 deletions
This file was deleted.

deps/rabbitmq_stomp/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ erlc(
8787
"src/**/*.hrl",
8888
]),
8989
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
90+
dest = "test",
9091
deps = [
9192
":test_bazel_erlang_lib",
9293
],

deps/rabbitmq_web_dispatch/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ test_erlang_lib(
4343
app_name = APP_NAME,
4444
app_version = APP_VERSION,
4545
extra_apps = EXTRA_APPS,
46-
extra_priv = [
47-
"test/priv/www/index.html",
48-
],
4946
deps = DEPS,
5047
)
5148

@@ -84,6 +81,9 @@ suites = [
8481
rabbitmq_integration_suite(
8582
PACKAGE,
8683
name = "rabbit_web_dispatch_SUITE",
84+
data = [
85+
"test/priv/www/index.html",
86+
],
8787
),
8888
rabbitmq_suite(
8989
name = "rabbit_web_dispatch_unit_SUITE",

deps/rabbitmq_web_dispatch/test/rabbit_web_dispatch_SUITE.erl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,9 @@ query_static_resource_test1(Host, Port) ->
7171
rabbit_web_dispatch:register_static_context(test, [{port, Port}],
7272
"rabbit_web_dispatch_test",
7373
?MODULE, "test/priv/www", "Test"),
74-
inets:start(),
7574
{ok, {_Status, _Headers, Body}} =
7675
httpc:request(format("http://~s:~w/rabbit_web_dispatch_test/index.html", [Host, Port])),
77-
?assert(string:str(Body, "RabbitMQ HTTP Server Test Page") /= 0),
78-
79-
passed.
76+
?assertMatch(I when I > 0, string:str(Body, "RabbitMQ HTTP Server Test Page")).
8077

8178
add_idempotence_test(Config) ->
8279
Port = rabbit_ct_broker_helpers:get_node_config(Config, 0, tcp_port_http_extra),

deps/rabbitmq_web_mqtt/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ erlc(
6767
name = "test_utils",
6868
srcs = glob(["test/src/*.erl"]),
6969
hdrs = glob(["test/src/*.hrl"]),
70+
dest = "test",
7071
erlc_opts = RABBITMQ_TEST_ERLC_OPTS,
7172
)
7273

rabbitmq.bzl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,7 @@ def rabbitmq_integration_suite(
128128
erlc_opts = RABBITMQ_TEST_ERLC_OPTS + erlc_opts,
129129
additional_hdrs = additional_hdrs,
130130
additional_srcs = additional_srcs,
131-
data = [
132-
"//deps/rabbitmq_ct_helpers/tools/tls-certs:Makefile",
133-
"//deps/rabbitmq_ct_helpers/tools/tls-certs:openssl.cnf.in",
134-
] + data,
131+
data = data,
135132
test_env = dict({
136133
"SKIP_MAKE_TEST_DIST": "true",
137134
"RABBITMQ_CT_SKIP_AS_ERROR": "true",
@@ -160,10 +157,7 @@ def rabbitmq_integration_suite(
160157
name = name + "-mixed",
161158
suite_name = name,
162159
tags = tags + ["mixed-version-cluster"],
163-
data = [
164-
"//deps/rabbitmq_ct_helpers/tools/tls-certs:Makefile",
165-
"//deps/rabbitmq_ct_helpers/tools/tls-certs:openssl.cnf.in",
166-
] + data,
160+
data = data,
167161
test_env = dict({
168162
"SKIP_MAKE_TEST_DIST": "true",
169163
"RABBITMQ_FEATURE_FLAGS": "",

0 commit comments

Comments
 (0)