Skip to content

Commit b2cf0ed

Browse files
New command group: 'deprecated_features'
1 parent 348760e commit b2cf0ed

File tree

4 files changed

+109
-3
lines changed

4 files changed

+109
-3
lines changed

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
11
# rabbitmqadmin-ng Change Log
22

3-
## v0.16.0 (in development)
3+
## v0.17.0 (in development)
44

55
No (documented) changes yet.
66

77

8+
## v0.16.0 (Dec 29, 2024)
9+
10+
### Enhancements
11+
12+
* `rabbitmqadmin feature_flags list` (also available as `rabbitmqadmin list feature_flags`) is a new command
13+
that lists feature flags and their cluster state.
14+
15+
GitHub issue: [#38](https://github.com/rabbitmq/rabbitmqadmin-ng/issues/38)
16+
17+
* `rabbitmqadmin feature_flags enable --name {feature flag}` and `rabbitmqadmin feature_flags enable_all` are new commands
18+
that enable feature flags.
19+
20+
Just like its `rabbitmqctl` counterpart, `rabbitmqadmin feature_flags enable_all` will only enable
21+
the stable feature flags and will skip the experimental ones.
22+
23+
GitHub issues: [#41](https://github.com/rabbitmq/rabbitmqadmin-ng/issues/41)
24+
25+
* `rabbitmqadmin deprecated_features list` (also available as `rabbitmqadmin list deprecated_features`) is a new
26+
function that lists all [deprecated features](https://www.rabbitmq.com/docs/deprecated-features).
27+
28+
GitHub issue: [#39](https://github.com/rabbitmq/rabbitmqadmin-ng/issues/39)
29+
30+
* `rabbitmqadmin deprecated_features list_used` (also available as `rabbitmqadmin list deprecated_features_in_use`) is a new
31+
function that lists the [deprecated features](https://www.rabbitmq.com/docs/deprecated-features) that are found to be
32+
used in the cluster.
33+
34+
GitHub issue: [#40](https://github.com/rabbitmq/rabbitmqadmin-ng/issues/40)
35+
36+
837
## v0.15.0 (Dec 26, 2024)
938

1039
### Enhancements

src/cli.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn parser() -> Command {
120120
.short('p')
121121
.long("password")
122122
.requires("username")
123-
.help("must be specified if --username is used"),
123+
.help("requires username to be specified via --username or in the config file"),
124124
)
125125
// --insecure
126126
.arg(
@@ -248,6 +248,14 @@ pub fn parser() -> Command {
248248
))
249249
.subcommand_value_name("feature flag")
250250
.subcommands(feature_flags_subcommands()),
251+
Command::new("deprecated_features")
252+
.about("operations on deprecated features")
253+
.after_long_help(color_print::cformat!(
254+
"<bold>Doc guide</bold>: {}",
255+
DEPRECATED_FEATURE_GUIDE_URL
256+
))
257+
.subcommand_value_name("deprecated feature")
258+
.subcommands(deprecated_features_subcommands()),
251259
Command::new("publish")
252260
.about(color_print::cstr!("Publishes (<red>inefficiently</red>) message(s) to a queue or a stream. <bold><red>Only suitable for development and test environments</red></bold>."))
253261
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", PUBLISHER_GUIDE_URL))
@@ -1042,6 +1050,24 @@ pub fn feature_flags_subcommands() -> [Command; 3] {
10421050
[list_cmd, enable_cmd, enable_all_cmd]
10431051
}
10441052

1053+
pub fn deprecated_features_subcommands() -> [Command; 2] {
1054+
let list_cmd = Command::new("list")
1055+
.long_about("Lists deprecated features")
1056+
.after_long_help(color_print::cformat!(
1057+
"<bold>Doc guide</bold>: {}",
1058+
DEPRECATED_FEATURE_GUIDE_URL
1059+
));
1060+
1061+
let list_in_use_cmd = Command::new("list_used")
1062+
.long_about("Lists the deprecated features that are found to be in use in the cluster")
1063+
.after_long_help(color_print::cformat!(
1064+
"<bold>Doc guide</bold>: {}",
1065+
DEPRECATED_FEATURE_GUIDE_URL
1066+
));
1067+
1068+
[list_cmd, list_in_use_cmd]
1069+
}
1070+
10451071
pub fn publish_subcommands() -> [Command; 1] {
10461072
[Command::new("message")
10471073
.about("Publishes a message to an exchange")

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ fn dispatch_subcommand(
384384
let result = commands::enable_all_stable_feature_flags(client);
385385
res_handler.no_output_on_success(result);
386386
}
387+
("deprecated_features", "list") => {
388+
let result = commands::list_deprecated_features(client);
389+
res_handler.tabular_result(result.map(|val| val.0))
390+
}
391+
("deprecated_features", "list_used") => {
392+
let result = commands::list_deprecated_features_in_use(client);
393+
res_handler.tabular_result(result.map(|val| val.0))
394+
}
387395
("publish", "message") => {
388396
let result = commands::publish_message(client, &vhost, command_args);
389397
res_handler.single_value_result(result)

tests/list_deprecated_feature_tests.rs renamed to tests/deprecated_feature_tests.rs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::test_helpers::*;
1919

2020
#[test]
2121
fn test_list_all_deprecated_features() -> Result<(), Box<dyn std::error::Error>> {
22-
run_succeeds(["list", "deprecated_features"]).stdout(predicate::str::contains("ram_node_type"));
22+
run_succeeds(["deprecated_features", "list"]).stdout(predicate::str::contains("ram_node_type"));
2323

2424
Ok(())
2525
}
@@ -31,6 +31,49 @@ fn test_list_deprecated_features_in_use() -> Result<(), Box<dyn std::error::Erro
3131

3232
delete_vhost(vh).expect("failed to delete a virtual host");
3333

34+
// there are no deprecated features in use at this point
35+
run_succeeds(["deprecated_features", "list_used"])
36+
.stdout(predicate::str::contains("transient_nonexcl_queues").not());
37+
38+
run_succeeds(["declare", "vhost", "--name", vh]);
39+
run_succeeds([
40+
"-V",
41+
vh,
42+
"declare",
43+
"queue",
44+
"--name",
45+
q,
46+
"--type",
47+
"classic",
48+
"--durable",
49+
"false",
50+
]);
51+
52+
await_queue_metric_emission();
53+
54+
// now there is: a non-exclusive transient queue
55+
run_succeeds(["list", "deprecated_features_in_use"])
56+
.stdout(predicate::str::contains("transient_nonexcl_queues"));
57+
58+
delete_vhost(vh).expect("failed to delete a virtual host");
59+
60+
Ok(())
61+
}
62+
63+
#[test]
64+
fn test_list_all_deprecated_features_via_alias() -> Result<(), Box<dyn std::error::Error>> {
65+
run_succeeds(["list", "deprecated_features"]).stdout(predicate::str::contains("ram_node_type"));
66+
67+
Ok(())
68+
}
69+
70+
#[test]
71+
fn test_list_deprecated_features_in_use_via_alias() -> Result<(), Box<dyn std::error::Error>> {
72+
let vh = "test_list_deprecated_features_in_use_via_alias";
73+
let q = "test_list_deprecated_features_in_use_via_alias.cq.transient.1";
74+
75+
delete_vhost(vh).expect("failed to delete a virtual host");
76+
3477
// there are no deprecated features in use at this point
3578
run_succeeds(["list", "deprecated_features_in_use"])
3679
.stdout(predicate::str::contains("transient_nonexcl_queues").not());

0 commit comments

Comments
 (0)