MXS-2984: Fix list listeners

Backported the changed from 2.5 to 2.3 and added a test case.
This commit is contained in:
Markus Mäkelä
2020-06-01 09:26:33 +03:00
parent ce437bc779
commit 2e1b0c5ddf
3 changed files with 12 additions and 2 deletions

View File

@ -197,7 +197,7 @@ module.exports = function() {
row = [] row = []
fields.forEach(function(p) { fields.forEach(function(p) {
var v = _.getPath(i, p[p.name], '') var v = _.getPath(i, p.path, '')
if (Array.isArray(v) && typeof(v[0]) != 'object') { if (Array.isArray(v) && typeof(v[0]) != 'object') {
v = v.join(', ') v = v.join(', ')

View File

@ -87,7 +87,7 @@ const list_listeners_fields = [
}, },
{ {
name: 'Host', name: 'Host',
path: 'attributes.parameters.host', path: 'attributes.parameters.address',
description: 'The address or socket where the listener listens' description: 'The address or socket where the listener listens'
}, },
{ {

View File

@ -42,6 +42,16 @@ describe("Diagnostic Commands", function() {
}); });
}) })
it('MXS-2984: Malformed `list listeners` output', function() {
return doCommand('list listeners RW-Split-Router --tsv')
.then(res => {
var d = res.split('\t')
d[0].should.equal('RW-Split-Listener')
d[1].should.equal('4006')
d[2].should.equal('::')
})
});
after(stopMaxScale) after(stopMaxScale)
}); });