Skip to content

HTTP API: make sure virtual host limit values are returned as a JSON object #12081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rabbitmq_peer_discovery_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
ecs-cli --version
- name: AUTHENTICATE TO GOOGLE CLOUD
if: steps.authorized.outputs.authorized == 'true'
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: CONFIGURE BAZEL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: BUILD SECONDARY UMBRELLA ARCHIVE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates/test.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
run: |
echo "value=bazel-repo-cache-${{ hashFiles('MODULE.bazel') }}" | tee -a $GITHUB_OUTPUT
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: REPO CACHE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-authnz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
https://cdn.jsdelivr.net/hex

- name: Authenticate To Google Cloud
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-mixed-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: BUILD SECONDARY UMBRELLA ARCHIVE
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-plugin-mixed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: CONFIGURE BAZEL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: CONFIGURE BAZEL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
pull_request:
paths:
- 'deps/rabbitmq_management/**'
- .github/workflows/test-selenium-for-pull-requests.yaml
- .github/workflows/test-selenium-for-pull-requests.yaml
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
https://cdn.jsdelivr.net/hex

- name: Authenticate To Google Cloud
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
echo "value=bazel-repo-cache-${{ hashFiles('MODULE.bazel') }}" | tee -a $GITHUB_OUTPUT
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected].4
uses: google-github-actions/[email protected].5
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: REPO CACHE
Expand Down
16 changes: 12 additions & 4 deletions deps/rabbitmq_management/src/rabbit_mgmt_wm_limits.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ limits(ReqData, Context) ->
none ->
User = Context#context.user,
VisibleVhosts = rabbit_mgmt_util:list_visible_vhosts_names(User),
[ [{vhost, VHost}, {value, Value}]
|| {VHost, Value} <- rabbit_vhost_limit:list(),
lists:member(VHost, VisibleVhosts) ];
[
#{
vhost => VHost,
value => rabbit_data_coercion:to_map(Value)
} || {VHost, Value} <- rabbit_vhost_limit:list(), lists:member(VHost, VisibleVhosts)
];
VHost when is_binary(VHost) ->
case rabbit_vhost_limit:list(VHost) of
[] -> [];
Value -> [[{vhost, VHost}, {value, Value}]]
Value -> [
#{
vhost => VHost,
value => rabbit_data_coercion:to_map(Value)
}
]
end
end.
%%--------------------------------------------------------------------
7 changes: 4 additions & 3 deletions deps/rabbitmq_management/test/rabbit_mgmt_http_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3411,13 +3411,14 @@ vhost_limits_list_test(Config) ->
lists:map(
fun(#{vhost := VHost, value := Val}) ->
Param = [ {atom_to_binary(K, utf8),V} || {K,V} <- maps:to_list(Val) ],
ct:pal("Setting limits of virtual host '~ts' to ~tp", [VHost, Param]),
ok = rabbit_ct_broker_helpers:set_parameter(Config, 0, VHost, <<"vhost-limits">>, <<"limits">>, Param)
end,
Expected),

Expected = http_get(Config, "/vhost-limits", ?OK),
Limits1 = http_get(Config, "/vhost-limits/limit_test_vhost_1", ?OK),
Limits2 = http_get(Config, "/vhost-limits/limit_test_vhost_2", ?OK),
?assertEqual(lists:usort(Expected), lists:usort(http_get(Config, "/vhost-limits", ?OK))),
?assertEqual(Limits1, http_get(Config, "/vhost-limits/limit_test_vhost_1", ?OK)),
?assertEqual(Limits2, http_get(Config, "/vhost-limits/limit_test_vhost_2", ?OK)),

NoVhostUser = <<"no_vhost_user">>,
rabbit_ct_broker_helpers:add_user(Config, NoVhostUser),
Expand Down
Loading