Skip to content
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

Update tests for rabbitmqctl version parsing #911

Merged
merged 1 commit into from
Aug 1, 2022

Conversation

wyardley
Copy link
Contributor

@wyardley wyardley commented Jul 31, 2022

Pull Request (PR) description

  • Update existing tests to include the leading spaces and some additional formatting
  • Add new test case for the newer format included in rabbitmqctl -q status that's included in RabbitMQ >= v3.8.x, originally fixed in Extend version regex for RabbitMQ 3.8 #814

See discussion in #872

That said, based on this, I believe the version parsing logic should function with >=3.8.x

This Pull Request (PR) fixes the following issues

@wyardley
Copy link
Contributor Author

new style output (newer versions)

root@14bc7f94c0ff:/# rabbitmqctl -q status
Runtime

OS PID: 263
OS: Linux
Uptime (seconds): 55
Is under maintenance?: false
RabbitMQ version: 3.8.34
Node name: rabbit@14bc7f94c0ff
Erlang configuration: Erlang/OTP 24 [erts-12.3.2.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Crypto library: OpenSSL 1.1.1o  3 May 2022
Erlang processes: 325 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60

Plugins

Enabled plugin file: /etc/rabbitmq/enabled_plugins
Enabled plugins:

 * rabbitmq_prometheus
 * rabbitmq_web_dispatch
 * prometheus
 * rabbitmq_management_agent
 * cowboy
 * cowlib

Data directory

Node data directory: /var/lib/rabbitmq/mnesia/rabbit@14bc7f94c0ff
Raft data directory: /var/lib/rabbitmq/mnesia/rabbit@14bc7f94c0ff/quorum/rabbit@14bc7f94c0ff

Config files

 * /etc/rabbitmq/rabbitmq.conf
 * /etc/rabbitmq/conf.d/management_agent.disable_metrics_collector.conf

Log file(s)

 * <stdout>

Alarms

(none)

Memory

Total memory used: 0.1045 gb
Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 0.8342 gb

code: 0.0321 gb (30.63 %)
other_proc: 0.032 gb (30.55 %)
other_system: 0.0247 gb (23.57 %)
allocated_unused: 0.0106 gb (10.12 %)
other_ets: 0.0031 gb (2.93 %)
atom: 0.0014 gb (1.35 %)
plugins: 3.0e-4 gb (0.32 %)
metrics: 2.0e-4 gb (0.22 %)
binary: 1.0e-4 gb (0.14 %)
mnesia: 1.0e-4 gb (0.09 %)
quorum_ets: 0.0 gb (0.05 %)
msg_index: 0.0 gb (0.03 %)
connection_channels: 0.0 gb (0.0 %)
connection_other: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
mgmt_db: 0.0 gb (0.0 %)
queue_procs: 0.0 gb (0.0 %)
queue_slave_procs: 0.0 gb (0.0 %)
quorum_queue_procs: 0.0 gb (0.0 %)
reserved_unallocated: 0.0 gb (0.0 %)

File Descriptors

Total: 2, limit: 1048479
Sockets: 0, limit: 943629

Free Disk Space

Low free disk space watermark: 0.05 gb
Free disk space: 52.4824 gb

Totals

Connection count: 0
Queue count: 0
Virtual host count: 1

Listeners

Interface: [::], port: 15692, protocol: http/prometheus, purpose: Prometheus exporter API over HTTP
Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0

3.7.x

[{pid,314},
 {running_applications,
     [{rabbit,"RabbitMQ","3.7.28"},
      {mnesia,"MNESIA  CXC 138 12","4.16.3"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
          "3.7.28"},
      {sysmon_handler,"Rate-limiting system_monitor event handler","1.1.0"},
      {os_mon,"CPO  CXC 138 46","2.5.1"},
      {ranch,"Socket acceptor pool for TCP protocols.","1.7.1"},
      {ssl,"Erlang/OTP SSL application","9.6.2.2"},
      {public_key,"Public key infrastructure","1.7.2"},
      {asn1,"The Erlang ASN1 compiler version 5.0.12","5.0.12"},
      {observer_cli,"Visualize Erlang Nodes On The Command Line","1.5.2"},
      {xmerl,"XML parser","1.3.24"},
      {recon,"Diagnostic tools for production use","2.5.0"},
      {jsx,"a streaming, evented json parsing toolkit","2.9.0"},
      {tools,"DEVTOOLS  CXC 138 16","3.3.1"},
      {credentials_obfuscation,
          "Helper library that obfuscates sensitive values in process state",
          "1.1.0"},
      {inets,"INETS  CXC 138 49","7.1.3.3"},
      {crypto,"CRYPTO","4.6.5.1"},
      {stdout_formatter,
          "Tools to format paragraphs, lists and tables as plain text",
          "0.2.2"},
      {lager,"Erlang logging framework","3.8.0"},
      {goldrush,"Erlang event stream processor","0.1.9"},
      {compiler,"ERTS  CXC 138 10","7.5.4.1"},
      {syntax_tools,"Syntax tools","2.2.1"},
      {sasl,"SASL  CXC 138 11","3.4.2"},
      {stdlib,"ERTS  CXC 138 10","3.12.1"},
      {kernel,"ERTS  CXC 138 10","6.5.2.1"}]},
 {os,{unix,linux}},
 {erlang_version,
     "Erlang/OTP 22 [erts-10.7.2.3] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64]\n"},
 {memory,
     [{connection_readers,0},
      {connection_writers,0},
      {connection_channels,0},
      {connection_other,0},
      {queue_procs,0},
      {queue_slave_procs,0},
      {plugins,11748},
      {other_proc,21381896},
      {metrics,195524},
      {mgmt_db,0},
      {mnesia,75896},
      {other_ets,2402184},
      {binary,149560},
      {msg_index,29824},
      {code,25737132},
      {atom,1180881},
      {other_system,22904691},
      {allocated_unused,10533544},
      {reserved_unallocated,0},
      {strategy,rss},
      {total,[{erlang,74069336},{rss,81956864},{allocated,84602880}]}]},
 {alarms,[]},
 {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]},
 {vm_memory_calculation_strategy,rss},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,834222489},
 {disk_free_limit,50000000},
 {disk_free,52482445312},
 {file_descriptors,
     [{total_limit,1048476},
      {total_used,2},
      {sockets_limit,943626},
      {sockets_used,0}]},
 {processes,[{limit,1048576},{used,233}]},
 {run_queue,1},
 {uptime,730},
 {kernel,{net_ticktime,60}}]

- Update existing tests to include the leading spaces and some
  additional formatting
- Add new test case for the newer format included in `rabbitmqctl -q
  status` that's included in RabbitMQ >= v3.8.x, originally fixed in
  voxpupuli#814

See discussion in voxpupuli#872
@wyardley wyardley force-pushed the wyardley/test_version_regex branch from cdeda37 to d8e1013 Compare July 31, 2022 23:31
@@ -13,18 +13,23 @@
end

it 'gets the RabbitMQ version' do
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.1.5"}'
expect(provider_class.rabbitmq_version).to eq('3.1.5')
provider_class.expects(:rabbitmqctl).with('-q', 'status').returns ' [{rabbit,"RabbitMQ","3.7.28"},'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note - I don't think the format has changed here between 3.1 and 3.7; just thought it was maybe a good idea to make the string a little more realistic (though it's still not multiline).

@wyardley wyardley merged commit 277e3e8 into voxpupuli:master Aug 1, 2022
@wyardley wyardley deleted the wyardley/test_version_regex branch August 1, 2022 13:19
@wyardley wyardley mentioned this pull request Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants