Skip to content

Commit 268804c

Browse files
Merge pull request #12213 from rabbitmq/mergify/bp/v4.0.x/pr-12198
Move selenium to root (backport #12198)
2 parents 2206d44 + 8650e79 commit 268804c

File tree

266 files changed

+360
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+360
-78
lines changed

.github/workflows/test-authnz.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- erlang_version: "26.2"
4343
elixir_version: 1.15.7
4444
env:
45-
SELENIUM_DIR: deps/rabbitmq_management/selenium
45+
SELENIUM_DIR: selenium
4646
DOCKER_NETWORK: rabbitmq_net
4747
steps:
4848
- name: Checkout
@@ -91,7 +91,8 @@ jobs:
9191
9292
- name: Run Suites
9393
run: |
94-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 ${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging
94+
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
95+
${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging
9596
9697
- name: Upload Test Artifacts
9798
if: always()
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Test Management UI with Selenium for PRs
2+
on:
3+
pull_request:
4+
paths:
5+
- 'deps/**'
6+
- 'selenium/**'
7+
- .github/workflows/test-management-ui-for-pr.yaml
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
jobs:
12+
selenium:
13+
runs-on: ubuntu-22.04
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
erlang_version:
18+
- "26.2"
19+
browser:
20+
- chrome
21+
include:
22+
- erlang_version: "26.2"
23+
elixir_version: 1.15.7
24+
env:
25+
SELENIUM_DIR: selenium
26+
DOCKER_NETWORK: rabbitmq_net
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Configure OTP & Elixir
32+
uses: erlef/setup-beam@v1.17
33+
with:
34+
otp-version: ${{ matrix.erlang_version }}
35+
elixir-version: ${{ matrix.elixir_version }}
36+
hexpm-mirrors: |
37+
https://builds.hex.pm
38+
https://cdn.jsdelivr.net/hex
39+
40+
- name: Authenticate To Google Cloud
41+
uses: google-github-actions/auth@v2.1.5
42+
with:
43+
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
44+
45+
- name: Configure Bazel
46+
run: |
47+
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
48+
cat << EOF >> user.bazelrc
49+
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
50+
build --google_default_credentials
51+
52+
build --remote_download_toplevel
53+
EOF
54+
fi
55+
cat << EOF >> user.bazelrc
56+
build --color=yes
57+
EOF
58+
59+
- name: Build & Load RabbitMQ OCI
60+
run: |
61+
bazelisk run packaging/docker-image:rabbitmq-amd64
62+
63+
- name: Configure Docker Network
64+
run: |
65+
docker network create ${DOCKER_NETWORK}
66+
67+
- name: Build Test Runner Image
68+
run: |
69+
cd ${SELENIUM_DIR}
70+
docker build -t mocha-test --target test .
71+
72+
- name: Run full ui suites on a standalone rabbitmq server
73+
run: |
74+
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
75+
${SELENIUM_DIR}/run-suites.sh
76+
mkdir -p /tmp/full-suite
77+
mv /tmp/selenium/* /tmp/full-suite
78+
mkdir -p /tmp/full-suite/logs
79+
mv ${SELENIUM_DIR}/logs/* /tmp/full-suite/logs
80+
mkdir -p /tmp/full-suite/screens
81+
mv ${SELENIUM_DIR}/screens/* /tmp/full-suite/screens
82+
83+
- name: Upload Test Artifacts
84+
if: always()
85+
uses: actions/upload-artifact@v4.3.2
86+
with:
87+
name: test-artifacts-${{ matrix.browser }}-${{ matrix.erlang_version }}
88+
path: |
89+
/tmp/full-suite
90+
91+
summary-selenium:
92+
needs:
93+
- selenium
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: SUMMARY
97+
run: |
98+
echo "SUCCESS"

.github/workflows/test-selenium.yaml renamed to .github/workflows/test-management-ui.yaml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ on:
1616
- BUILD.*
1717
- '*.bzl'
1818
- '*.bazel'
19-
- .github/workflows/test-selenium.yaml
20-
pull_request:
21-
paths:
22-
- 'deps/rabbitmq_management/**'
23-
- .github/workflows/test-selenium-for-pull-requests.yaml
19+
- 'selenium/**'
20+
- .github/workflows/test-management-ui.yaml
21+
2422
concurrency:
2523
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2624
cancel-in-progress: true
@@ -38,7 +36,7 @@ jobs:
3836
- erlang_version: "26.2"
3937
elixir_version: 1.15.7
4038
env:
41-
SELENIUM_DIR: deps/rabbitmq_management/selenium
39+
SELENIUM_DIR: selenium
4240
DOCKER_NETWORK: rabbitmq_net
4341
steps:
4442
- name: Checkout
@@ -85,17 +83,6 @@ jobs:
8583
cd ${SELENIUM_DIR}
8684
docker build -t mocha-test --target test .
8785
88-
- name: Run full ui suites on a standalone rabbitmq server
89-
run: |
90-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
91-
${SELENIUM_DIR}/run-suites.sh
92-
mkdir -p /tmp/full-suite
93-
mv /tmp/selenium/* /tmp/full-suite
94-
mkdir -p /tmp/full-suite/logs
95-
mv ${SELENIUM_DIR}/logs/* /tmp/full-suite/logs
96-
mkdir -p /tmp/full-suite/screens
97-
mv ${SELENIUM_DIR}/screens/* /tmp/full-suite/screens
98-
9986
- name: Run short ui suite on a 3-node rabbitmq cluster
10087
run: |
10188
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 \
@@ -113,7 +100,6 @@ jobs:
113100
with:
114101
name: test-artifacts-${{ matrix.browser }}-${{ matrix.erlang_version }}
115102
path: |
116-
/tmp/full-suite
117103
/tmp/short-suite
118104
119105
summary-selenium:

deps/rabbitmq_auth_backend_oauth2/test/config_schema_SUITE_data/rabbitmq_auth_backend_oauth2.snippets

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
{oauth2_pem_config2,
2+
{root_resource_server,
33
"auth_oauth2.resource_server_id = new_resource_server_id
44
auth_oauth2.scope_prefix = new_resource_server_id.
55
auth_oauth2.resource_server_type = new_resource_server_type
@@ -51,7 +51,7 @@
5151
]}
5252
],[]
5353
},
54-
{oauth2_pem_config3,
54+
{multiple_resource_servers,
5555
"auth_oauth2.resource_server_id = new_resource_server_id
5656
auth_oauth2.scope_prefix = new_resource_server_id.
5757
auth_oauth2.resource_server_type = new_resource_server_type
@@ -92,7 +92,7 @@
9292
],
9393
<<"rabbitmq-customers">> => [
9494
{additional_scopes_key, <<"roles">>},
95-
{id, <<"rabbitmq-customers">>}
95+
{id, <<"rabbitmq-customers">>}
9696
]
9797
}
9898
},
@@ -117,7 +117,7 @@
117117
]}
118118
],[]
119119
},
120-
{oauth2_pem_config4,
120+
{multiple_oauth_providers,
121121
"auth_oauth2.resource_server_id = new_resource_server_id
122122
auth_oauth2.scope_prefix = new_resource_server_id.
123123
auth_oauth2.resource_server_type = new_resource_server_type
@@ -174,5 +174,15 @@
174174
}
175175
]}
176176
],[]
177+
},
178+
{empty_scope_prefix,
179+
"auth_oauth2.resource_server_id = new_resource_server_id
180+
auth_oauth2.scope_prefix = '' ",
181+
[
182+
{rabbitmq_auth_backend_oauth2, [
183+
{resource_server_id,<<"new_resource_server_id">>},
184+
{scope_prefix,<<>>}
185+
]}
186+
],[]
177187
}
178188
].

deps/rabbitmq_auth_backend_oauth2/test/rabbit_oauth2_config_SUITE.erl

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ groups() -> [
130130
is_verify_aud_for_resource_one_returns_true,
131131
is_verify_aud_for_resource_two_returns_false
132132
]},
133+
get_scope_prefix_for_resource_one_returns_default_scope_prefix,
134+
{with_root_scope_prefix, [], [
135+
get_scope_prefix_for_resource_one_returns_root_scope_prefix,
136+
{with_empty_scope_prefix_for_resource_one, [], [
137+
get_scope_prefix_for_resource_one_returns_empty_scope_prefix,
138+
get_scope_prefix_for_resource_two_returns_root_scope_prefix
139+
]}
140+
]},
133141
{with_jwks_url, [], [
134142
get_oauth_provider_for_both_resources_should_return_root_oauth_provider,
135143
{with_oauth_providers_A_with_jwks_uri, [], [
@@ -160,6 +168,7 @@ groups() -> [
160168
get_default_preferred_username_claims,
161169
get_preferred_username_claims,
162170
get_scope_prefix,
171+
get_empty_scope_prefix,
163172
get_scope_prefix_when_not_defined,
164173
get_resource_server_type,
165174
get_resource_server_type_when_not_defined,
@@ -309,6 +318,16 @@ init_per_group(with_resource_server_id, Config) ->
309318
application:set_env(rabbitmq_auth_backend_oauth2, resource_server_id, ?RABBITMQ),
310319
Config;
311320

321+
init_per_group(with_root_scope_prefix, Config) ->
322+
application:set_env(rabbitmq_auth_backend_oauth2, scope_prefix, <<"some-prefix:">>),
323+
Config;
324+
init_per_group(with_empty_scope_prefix_for_resource_one, Config) ->
325+
ResourceServers = application:get_env(rabbitmq_auth_backend_oauth2, resource_servers, #{}),
326+
Proplist = maps:get(?RABBITMQ_RESOURCE_ONE, ResourceServers, []),
327+
application:set_env(rabbitmq_auth_backend_oauth2, resource_servers,
328+
maps:put(?RABBITMQ_RESOURCE_ONE, [{scope_prefix, <<"">>} | proplists:delete(scope_prefix, Proplist)], ResourceServers)),
329+
Config;
330+
312331
init_per_group(with_verify_aud_false, Config) ->
313332
application:set_env(rabbitmq_auth_backend_oauth2, verify_aud, false),
314333
Config;
@@ -405,7 +424,9 @@ end_per_group(with_root_static_signing_keys, Config) ->
405424
KeyConfig = call_get_env(Config, key_config, []),
406425
call_set_env(Config, key_config, KeyConfig),
407426
Config;
408-
427+
end_per_group(get_empty_scope_prefix, Config) ->
428+
application:unset_env(rabbitmq_auth_backend_oauth2, scope_prefix),
429+
Config;
409430
end_per_group(with_resource_server_id, Config) ->
410431
application:unset_env(rabbitmq_auth_backend_oauth2, resource_server_id),
411432
Config;
@@ -418,6 +439,13 @@ end_per_group(with_verify_aud_false_for_resource_two, Config) ->
418439
application:set_env(rabbitmq_auth_backend_oauth2, resource_servers,
419440
maps:put(?RABBITMQ_RESOURCE_TWO, proplists:delete(verify_aud, Proplist), ResourceServers)),
420441
Config;
442+
end_per_group(with_empty_scope_prefix_for_resource_one, Config) ->
443+
ResourceServers = application:get_env(rabbitmq_auth_backend_oauth2, resource_servers, #{}),
444+
Proplist = maps:get(?RABBITMQ_RESOURCE_ONE, ResourceServers, []),
445+
application:set_env(rabbitmq_auth_backend_oauth2, resource_servers,
446+
maps:put(?RABBITMQ_RESOURCE_ONE, proplists:delete(scope_prefix, Proplist), ResourceServers)),
447+
Config;
448+
421449
end_per_group(with_default_key, Config) ->
422450
KeyConfig = application:get_env(rabbitmq_auth_backend_oauth2, key_config, []),
423451
application:set_env(rabbitmq_auth_backend_oauth2, key_config,
@@ -507,6 +535,10 @@ end_per_group(inheritance_group, Config) ->
507535
application:unset_env(rabbitmq_auth_backend_oauth2, resource_servers),
508536
Config;
509537

538+
end_per_group(with_root_scope_prefix, Config) ->
539+
application:unset_env(rabbitmq_auth_backend_oauth2, scope_prefix),
540+
Config;
541+
510542
end_per_group(_any, Config) ->
511543
Config.
512544

@@ -520,6 +552,9 @@ init_per_testcase(get_additional_scopes_key_when_not_defined, Config) ->
520552
init_per_testcase(is_verify_aud_when_is_false, Config) ->
521553
application:set_env(rabbitmq_auth_backend_oauth2, verify_aud, false),
522554
Config;
555+
init_per_testcase(get_empty_scope_prefix, Config) ->
556+
application:set_env(rabbitmq_auth_backend_oauth2, scope_prefix, <<"">>),
557+
Config;
523558
init_per_testcase(get_scope_prefix_when_not_defined, Config) ->
524559
application:unset_env(rabbitmq_auth_backend_oauth2, scope_prefix),
525560
Config;
@@ -756,11 +791,35 @@ get_scope_prefix_when_not_defined(_Config) ->
756791
?assertEqual(<<"rabbitmq.">>, rabbit_oauth2_config:get_scope_prefix()),
757792
?assertEqual(<<"rabbitmq2.">>, rabbit_oauth2_config:get_scope_prefix(<<"rabbitmq2">>)).
758793

794+
get_empty_scope_prefix(_Config) ->
795+
?assertEqual(<<"">>, rabbit_oauth2_config:get_scope_prefix()),
796+
?assertEqual(<<"">>, rabbit_oauth2_config:get_scope_prefix(<<"rabbitmq2">>)).
797+
759798
get_scope_prefix(_Config) ->
760799
?assertEqual(<<"some-prefix-">>, rabbit_oauth2_config:get_scope_prefix()),
761800
?assertEqual(<<"my-prefix:">>, rabbit_oauth2_config:get_scope_prefix(<<"rabbitmq1">>)),
762801
?assertEqual(rabbit_oauth2_config:get_scope_prefix(), rabbit_oauth2_config:get_scope_prefix(<<"rabbitmq2">>)).
763802

803+
get_scope_prefix_for_resource_one_returns_default_scope_prefix(_Config) ->
804+
?assertEqual(undefined, application:get_env(rabbitmq_auth_backend_oauth2, scope_prefix)),
805+
?assertEqual(append_paths(?RABBITMQ_RESOURCE_ONE, <<".">>),
806+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_ONE)).
807+
get_scope_prefix_for_resource_one_returns_root_scope_prefix(_Config) ->
808+
{ok, Prefix} = application:get_env(rabbitmq_auth_backend_oauth2, scope_prefix),
809+
?assertEqual(rabbit_oauth2_config:get_scope_prefix(),
810+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_ONE)),
811+
?assertEqual(Prefix,
812+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_ONE)).
813+
get_scope_prefix_for_resource_one_returns_empty_scope_prefix(_Config) ->
814+
?assertEqual(<<"">>,
815+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_ONE)).
816+
get_scope_prefix_for_resource_two_returns_root_scope_prefix(_Config) ->
817+
{ok, Prefix} = application:get_env(rabbitmq_auth_backend_oauth2, scope_prefix),
818+
?assertEqual(rabbit_oauth2_config:get_scope_prefix(),
819+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_TWO)),
820+
?assertEqual(Prefix,
821+
rabbit_oauth2_config:get_scope_prefix(?RABBITMQ_RESOURCE_TWO)).
822+
764823
get_resource_server_type_when_not_defined(_Config) ->
765824
?assertEqual(<<>>, rabbit_oauth2_config:get_resource_server_type()),
766825
?assertEqual(<<>>, rabbit_oauth2_config:get_resource_server_type(<<"rabbitmq2">>)).

deps/rabbitmq_auth_backend_oauth2/test/unit_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ test_validate_payload_resource_server_id_mismatch(_) ->
12701270
rabbit_auth_backend_oauth2:validate_payload(?RESOURCE_SERVER_ID, EmptyAud, ?DEFAULT_SCOPE_PREFIX)).
12711271

12721272
test_validate_payload_with_scope_prefix(_) ->
1273-
Scenarios = [ { <<>>,
1273+
Scenarios = [ { <<"">>,
12741274
#{<<"aud">> => [?RESOURCE_SERVER_ID],
12751275
<<"scope">> => [<<"foo">>, <<"foo.bar">>, <<"foo.other.third">> ]},
12761276
[<<"foo">>, <<"foo.bar">>, <<"foo.other.third">> ]

deps/rabbitmq_management/selenium/test/authnz-msg-protocols/env.local

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/rabbitmq_management/selenium/test/multi-oauth/env.local.devkeycloak

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

deps/rabbitmq_management/selenium/test/multi-oauth/env.local.prodkeycloak

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

deps/rabbitmq_management/selenium/test/oauth/env.local

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)