Skip to content

Commit 122831a

Browse files
authored
Merge pull request #241 from rabbitmq/add-eunit-rule-test
Add one eunit test for shard_suite
2 parents c58efcf + 6693963 commit 122831a

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

test/shard_suite/BUILD.bazel

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ load(
2525
"dialyze",
2626
"plt",
2727
)
28+
load(
29+
"@rules_erlang//:eunit2.bzl",
30+
"eunit",
31+
)
2832
load(
2933
"@rules_erlang//:ct.bzl",
3034
"ct_suite",
@@ -96,12 +100,57 @@ dialyze(
96100
plt = ":base_plt",
97101
)
98102

103+
erlang_bytecode(
104+
name = "test_example_suite_beam",
105+
testonly = True,
106+
srcs = [
107+
"test/example_suite.erl",
108+
],
109+
dest = "test",
110+
erlc_opts = DEFAULT_TEST_ERLC_OPTS + [
111+
"+nowarn_export_all",
112+
],
113+
)
114+
115+
erlang_bytecode(
116+
name = "test_example_suite_missing_group_beam",
117+
testonly = True,
118+
srcs = [
119+
"test/example_suite_missing_group.erl",
120+
],
121+
dest = "test",
122+
erlc_opts = DEFAULT_TEST_ERLC_OPTS + [
123+
"+nowarn_export_all",
124+
],
125+
)
126+
127+
erlang_bytecode(
128+
name = "test_shard_suite_test_beam",
129+
testonly = True,
130+
srcs = [
131+
"test/shard_suite_test.erl",
132+
],
133+
dest = "test",
134+
erlc_opts = DEFAULT_TEST_ERLC_OPTS + [
135+
"+nowarn_export_all",
136+
],
137+
)
138+
139+
eunit(
140+
name = "eunit",
141+
compiled_suites = [
142+
":test_example_suite_beam",
143+
":test_shard_suite_test_beam",
144+
],
145+
target = ":test_erlang_app",
146+
)
147+
99148
ct_suite(
100149
name = "shard_suite_SUITE",
101150
size = "small",
102-
additional_srcs = [
103-
"test/example_suite.erl",
104-
"test/example_suite_missing_group.erl",
151+
additional_beam = [
152+
":test_example_suite_beam",
153+
":test_example_suite_missing_group_beam",
105154
],
106155
)
107156

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-module(shard_suite_test).
2+
-include_lib("eunit/include/eunit.hrl").
3+
4+
%% A basic eunit test, to prove that the eunit rule works
5+
6+
basic_test() ->
7+
SuiteModule = example_suite,
8+
S = shard_suite:structure(SuiteModule),
9+
Cases = shard_suite:ordered_cases(S),
10+
?assertMatch({ok, _},
11+
shard_suite:shard(group, Cases, 2, 3)).

0 commit comments

Comments
 (0)